Part Number Hot Search : 
1N4741A 1N5382 7545A 02003 LN351GPX KBP206G 1N4948 XFVDSLCO
Product Description
Full Text Search
 

To Download MC68HC908MR8VDW Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  www.motorola.com/semiconductors m68hc08 microcontrollers mc68hc908mr8/d rev. 4, 8/2002 mc68hc908mr8 technical data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola 3 mc68hc908mr8 technical data ? rev 4.0 motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. "typical" parameters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all operating parameters, including "typicals" must be validated for each customer application by customer?s technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola, inc. is an equal opportunity/affirmative action employer. motorola and are registered trademarks of motorola, inc. digitaldna is a trademark of motorola, inc. ? motorola, inc., 2002 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 4 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola list of paragraphs 5 technical data ? mc68hc908mr8 list of paragraphs section 1. general description . . . . . . . . . . . . . . . . . . . . 29 section 2. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . 37 section 3. random-access memory (ram) . . . . . . . . . . 53 section 4. flash memory . . . . . . . . . . . . . . . . . . . . . . . . 55 section 5. configuration register (config) . . . . . . . . . 67 section 6. central processor unit (cpu) . . . . . . . . . . . . 71 section 7. system integration module (sim) . . . . . . . . . 89 section 8. clock generator module (cgm) . . . . . . . . . . 111 section 9. pulse-width modulator for motor control (pwmmc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 section 10. monitor rom (mon) . . . . . . . . . . . . . . . . . . 187 section 11. timer interface a (tima). . . . . . . . . . . . . . . 199 section 12. timer interface b (timb). . . . . . . . . . . . . . . 223 section 13. serial communications interface (sci) . . . 247 section 14. input/output (i/o) ports . . . . . . . . . . . . . . . 279 section 15. computer operating properly (cop) . . . . 291 section 16. external interrupt (irq) . . . . . . . . . . . . . . . 297 section 17. low-voltage inhibit (lvi) . . . . . . . . . . . . . . 305 section 18. analog-to-digital converter (adc) . . . . . . 311 section 19. power-on reset (por) . . . . . . . . . . . . . . . 327 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 6 list of paragraphs motorola list of paragraphs section 20. break (brk) . . . . . . . . . . . . . . . . . . . . . . . . . 329 section 21. electrical specifications. . . . . . . . . . . . . . . 339 section 22. mechanical specifications . . . . . . . . . . . . . 351 section 23. ordering information . . . . . . . . . . . . . . . . . 355 technical data ? revision history . . . . . . . . . . . . . . . . 357 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 7 technical data ? mc68hc908mr8 table of contents section 1. general description 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.5.1 power supply pins (v dd and v ss ) . . . . . . . . . . . . . . . . . . . . 34 1.5.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . . . 34 1.5.3 external reset pin (rst ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.5.4 external interrupt pin (irq ) . . . . . . . . . . . . . . . . . . . . . . . . . 35 1.5.5 cgm power supply pins (v dda and v ssa ) . . . . . . . . . . . . .35 1.5.6 adc reference voltage input pin (v refh ) . . . . . . . . . . . . .35 1.5.7 external filter capacitor pin (cgmxfc) . . . . . . . . . . . . . . . 35 1.5.8 port a input/output (i/o) pins (pta6/atd6 ? pta0/atd0). .35 1.5.9 port b i/o pins (ptb6/tchb1 ? ptb0/rxd) . . . . . . . . . . . . . 36 1.5.10 port c i/o pins (ptc1/fault1 ? ptc0/fault4). . . . . . . . .36 1.5.11 pwm pins (pwm6 ? pwm1) . . . . . . . . . . . . . . . . . . . . . . . . . 36 section 2. memory map 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.3 unimplemented memory locations . . . . . . . . . . . . . . . . . . . . .38 2.4 reserved memory locations . . . . . . . . . . . . . . . . . . . . . . . . . .38 2.5 i/o section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.6 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 8 table of contents motorola table of contents section 3. random-access memory (ram) 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 section 4. flash memory 4.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.2.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.2.2 flash control register. . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.2.3 flash page erase operation . . . . . . . . . . . . . . . . . . . . . . .58 4.2.4 flash mass erase operation . . . . . . . . . . . . . . . . . . . . . . .59 4.2.5 flash program/read operation. . . . . . . . . . . . . . . . . . . . . 59 4.3 flash programming algorithm . . . . . . . . . . . . . . . . . . . . . . . . 60 4.3.1 flash block protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.3.2 flash block protect register . . . . . . . . . . . . . . . . . . . . . . .63 4.3.3 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 4.3.3.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.3.3.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 section 5. configuration register (config) 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.3 config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4 config bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 section 6. central processor unit (cpu) 6.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 6.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 6.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 9 6.4.4 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 6.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . .76 6.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . .78 6.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 6.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 6.7 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.8 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 section 7. system integration module (sim) 7.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.3 sim bus clock control and generation . . . . . . . . . . . . . . . . . . 93 7.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 7.3.2 clock startup from por or lvi reset . . . . . . . . . . . . . . . . . 93 7.3.3 clocks in wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.4 reset and system initialization. . . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.1 external pin reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.2 active resets from internal sources . . . . . . . . . . . . . . . . . . 95 7.4.2.1 power-on reset (por) . . . . . . . . . . . . . . . . . . . . . . . . . . 96 7.4.2.2 computer operating properly (cop) reset. . . . . . . . . . . 97 7.4.2.3 illegal opcode reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.4.2.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.4.2.5 low-voltage inhibit (lvi) reset . . . . . . . . . . . . . . . . . . . . 98 7.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 7.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . . . 99 7.5.2 sim counter and reset states. . . . . . . . . . . . . . . . . . . . . . .99 7.6 exception control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 7.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 7.6.1.1 hardware interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 7.6.1.2 swi instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.6.3 status flag protection in break mode . . . . . . . . . . . . . . . .103 7.7 low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 7.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 10 table of contents motorola table of contents 7.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.7.3 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . . 106 7.7.4 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . . 108 7.7.5 sim break flag control register . . . . . . . . . . . . . . . . . . . . 109 section 8. clock generator module (cgm) 8.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 8.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 8.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 8.4.1 crystal oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 8.4.2 phase-locked loop circuit (pll) . . . . . . . . . . . . . . . . . . .115 8.4.2.1 pll circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 8.4.2.2 acquisition and tracking modes . . . . . . . . . . . . . . . . . .118 8.4.2.3 manual and automatic pll bandwidth modes . . . . . . .118 8.4.2.4 programming the pll . . . . . . . . . . . . . . . . . . . . . . . . . .120 8.4.2.5 special programming exceptions . . . . . . . . . . . . . . . . .121 8.4.3 base clock selector circuit . . . . . . . . . . . . . . . . . . . . . . . . 121 8.4.4 cgm external connections . . . . . . . . . . . . . . . . . . . . . . . . 122 8.5 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 8.5.1 crystal amplifier input pin (osc1). . . . . . . . . . . . . . . . . . . 123 8.5.2 crystal amplifier output pin (osc2) . . . . . . . . . . . . . . . . . 123 8.5.3 external filter capacitor pin (cgmxfc) . . . . . . . . . . . . . . 123 8.5.4 pll analog power pin (v dda ) . . . . . . . . . . . . . . . . . . . . . .124 8.5.5 oscillator enable signal (simoscen). . . . . . . . . . . . . . . . 124 8.5.6 crystal output frequency signal (cgmxclk) . . . . . . . . . 124 8.5.7 cgm base clock output (cgmout). . . . . . . . . . . . . . . . . 124 8.5.8 cgm cpu interrupt (cgmint) . . . . . . . . . . . . . . . . . . . . . 124 8.6 cgm registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 8.6.1 pll control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 8.6.2 pll bandwidth control register . . . . . . . . . . . . . . . . . . . . 129 8.6.3 pll programming register . . . . . . . . . . . . . . . . . . . . . . . . 131 8.7 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 8.8 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.9 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 11 8.10 cgm during break mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.11 acquisition/lock time specifications . . . . . . . . . . . . . . . . . . .134 8.11.1 acquisition/lock time definitions. . . . . . . . . . . . . . . . . . . . 134 8.11.2 parametric influences on reaction time . . . . . . . . . . . . . . 135 8.11.3 choosing a filter capacitor . . . . . . . . . . . . . . . . . . . . . . . . 136 8.11.4 reaction time calculation . . . . . . . . . . . . . . . . . . . . . . . . . 137 section 9. pulse-width modulator for motor control (pwmmc) 9.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 9.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 9.4 timebase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146 9.4.1 resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 9.4.2 prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.5 pwm generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.5.1 load operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.5.2 pwm data overflow and underflow conditions. . . . . . . . . 152 9.6 output control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 9.6.1 selecting six independent pwms or three complementary pwm pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 9.6.2 dead-time insertion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 9.6.3 output polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 9.6.4 output port control register . . . . . . . . . . . . . . . . . . . . . . . 159 9.7 fault protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 9.7.1 fault condition input pins . . . . . . . . . . . . . . . . . . . . . . . . . 164 9.7.1.1 fault pin filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 9.7.1.2 automatic mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 9.7.1.3 manual mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 9.7.2 software output disable . . . . . . . . . . . . . . . . . . . . . . . . . .168 9.7.3 output port control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 9.8 initialization and the pwmen bit . . . . . . . . . . . . . . . . . . . . . . 169 9.9 pwm operation in wait mode . . . . . . . . . . . . . . . . . . . . . . . . 170 9.10 pwm operation in stop mode . . . . . . . . . . . . . . . . . . . . . . . .170 9.11 pwm operation in break mode . . . . . . . . . . . . . . . . . . . . . . . 171 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 12 table of contents motorola table of contents 9.12 control logic block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 9.12.1 pwm counter registers. . . . . . . . . . . . . . . . . . . . . . . . . . . 172 9.12.2 pwm counter modulo registers . . . . . . . . . . . . . . . . . . . . 173 9.12.3 pwmx value registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 9.12.4 pwm control register 1. . . . . . . . . . . . . . . . . . . . . . . . . . . 175 9.12.5 pwm control register 2. . . . . . . . . . . . . . . . . . . . . . . . . . . 177 9.12.6 dead-time write-once register . . . . . . . . . . . . . . . . . . . . 179 9.12.7 pwm disable mapping write-once register . . . . . . . . . . . 179 9.12.8 fault control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 9.12.9 fault status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 9.12.10 fault acknowledge register. . . . . . . . . . . . . . . . . . . . . . . . 182 9.12.11 pwm output control register . . . . . . . . . . . . . . . . . . . . . . 184 9.13 pwm glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 section 10. monitor rom (mon) 10.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10.4.1 entering monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10.4.2 forced monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 10.4.3 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 10.4.4 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 10.4.5 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10.4.6 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 10.4.7 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 10.5 security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 section 11. timer interface a (tima) 11.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 11.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 11.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 11.4.1 tima counter prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . 204 11.4.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 13 11.4.3 output compare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 11.4.3.1 unbuffered output compare . . . . . . . . . . . . . . . . . . . . . 206 11.4.3.2 buffered output compare . . . . . . . . . . . . . . . . . . . . . . .206 11.4.4 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . . .207 11.4.4.1 unbuffered pwm signal generation . . . . . . . . . . . . . . . 208 11.4.4.2 buffered pwm signal generation . . . . . . . . . . . . . . . . .209 11.4.4.3 pwm initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 11.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 11.6 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 11.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 11.8 tima during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . 212 11.9 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 11.9.1 tima clock pin (ptb2/tclka) . . . . . . . . . . . . . . . . . . . . . 213 11.9.2 tima channel i/o pins (ptb3/tch0a ? ptb4/tch1a) . . . 213 11.10 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 11.10.1 tima status and control register . . . . . . . . . . . . . . . . . . .214 11.10.2 tima counter registers. . . . . . . . . . . . . . . . . . . . . . . . . . . 216 11.10.3 tima counter modulo registers . . . . . . . . . . . . . . . . . . . . 217 11.10.4 tima channel status and control registers . . . . . . . . . . . 218 11.10.5 tima channel registers . . . . . . . . . . . . . . . . . . . . . . . . . .222 section 12. timer interface b (timb) 12.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 12.4.1 timb counter prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.4.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.4.3 output compare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.4.3.1 unbuffered output compare . . . . . . . . . . . . . . . . . . . . . 230 12.4.3.2 buffered output compare . . . . . . . . . . . . . . . . . . . . . . .231 12.4.4 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . . .231 12.4.4.1 unbuffered pwm signal generation . . . . . . . . . . . . . . . 232 12.4.4.2 buffered pwm signal generation . . . . . . . . . . . . . . . . .233 12.4.4.3 pwm initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 14 table of contents motorola table of contents 12.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 12.6 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 12.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 12.8 timb during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . 236 12.9 timb channel i/o pins (ptb5/tch0b ? ptb6/tch1b) . . . . .237 12.10 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 12.10.1 timb status and control register . . . . . . . . . . . . . . . . . . .237 12.10.2 timb counter registers. . . . . . . . . . . . . . . . . . . . . . . . . . . 240 12.10.3 timb counter modulo registers . . . . . . . . . . . . . . . . . . . . 241 12.10.4 timb channel status and control registers . . . . . . . . . . . 242 12.10.5 timb channel registers . . . . . . . . . . . . . . . . . . . . . . . . . .245 section 13. serial communications interface (sci) 13.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 13.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 13.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 13.4.1 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 13.4.2 transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 13.4.2.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 13.4.2.2 character transmission . . . . . . . . . . . . . . . . . . . . . . . . . 252 13.4.2.3 break characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 13.4.2.4 idle characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 13.4.2.5 inversion of transmitted output. . . . . . . . . . . . . . . . . . . 255 13.4.2.6 transmitter interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . 255 13.4.3 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 13.4.3.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257 13.4.3.2 character reception . . . . . . . . . . . . . . . . . . . . . . . . . . .257 13.4.3.3 data sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 13.4.3.4 framing errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 13.4.3.5 receiver wakeup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 13.4.3.6 receiver interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 13.4.3.7 error interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 13.5 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 13.6 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 15 13.7 sci during break module interrupts. . . . . . . . . . . . . . . . . . . . 262 13.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 13.8.1 pte2/txd (transmit data). . . . . . . . . . . . . . . . . . . . . . . . . 263 13.8.2 ptb0/rxd (receive data) . . . . . . . . . . . . . . . . . . . . . . . . . 263 13.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 13.9.1 sci control register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 13.9.2 sci control register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 13.9.3 sci control register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 13.9.4 sci status register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 13.9.5 sci status register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 13.9.6 sci data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 13.9.7 sci baud rate register . . . . . . . . . . . . . . . . . . . . . . . . . .276 section 14. input/output (i/o) ports 14.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 14.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 14.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 14.3.2 data direction register a . . . . . . . . . . . . . . . . . . . . . . . . . 282 14.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 14.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 14.4.2 data direction register b. . . . . . . . . . . . . . . . . . . . . . . . . . 285 14.5 port c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 14.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287 14.5.2 data direction register c . . . . . . . . . . . . . . . . . . . . . . . . . 288 section 15. computer operating properly (cop) 15.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 15.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 15.4 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.1 cgmxclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.2 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.3 power-on reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.4 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 16 table of contents motorola table of contents 15.4.5 reset vector fetch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.4.6 cop disable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 15.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.8 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.9 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295 15.10 cop module during break mode . . . . . . . . . . . . . . . . . . . . . .295 section 16. external interrupt (irq) 16.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 16.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 16.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 16.5 irq pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 16.6 irq module during wait mode. . . . . . . . . . . . . . . . . . . . . . . . 302 16.7 irq module during stop mode. . . . . . . . . . . . . . . . . . . . . . . .302 16.8 irq module during break mode. . . . . . . . . . . . . . . . . . . . . . . 302 16.9 irq status and control register . . . . . . . . . . . . . . . . . . . . . . 303 section 17. low-voltage inhibit (lvi) 17.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 17.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 17.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 17.4.1 polled lvi operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.2 forced reset operation . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.3 false reset protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.4 lvi trip selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 17.5 lvi status and control register . . . . . . . . . . . . . . . . . . . . . . .308 17.6 lvi interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 17.7 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 17 17.8 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309 section 18. analog-to-digital converter (adc) 18.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.4.1 adc port i/o pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 18.4.2 voltage conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 18.4.3 conversion time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 18.4.4 continuous conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 18.4.5 result justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 18.4.6 monotonicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316 18.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 18.6 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 18.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .317 18.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 18.8.1 adc voltage reference pin (v refh ) . . . . . . . . . . . . . . . . . 317 18.8.2 adc voltage in (advin) . . . . . . . . . . . . . . . . . . . . . . . . . .318 18.8.3 adc external connection . . . . . . . . . . . . . . . . . . . . . . . . . 318 18.8.3.1 v refh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .318 18.8.3.2 anx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .318 18.8.3.3 grounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 18.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 18.9.1 adc status and control register. . . . . . . . . . . . . . . . . . . . 319 18.9.2 adc data register high . . . . . . . . . . . . . . . . . . . . . . . . . .322 18.9.3 adc data register low . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 18.9.4 adc clock register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 section 19. power-on reset (por) 19.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 19.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 18 table of contents motorola table of contents section 20. break (brk) 20.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 20.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 20.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 20.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 20.4.1 flag protection during break interrupts . . . . . . . . . . . . . . .330 20.4.2 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . . 332 20.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . 332 20.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . . . 332 20.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 20.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 20.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 20.6 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 20.6.1 break status and control register. . . . . . . . . . . . . . . . . . .333 20.6.2 break address registers . . . . . . . . . . . . . . . . . . . . . . . . . .334 20.6.3 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . . 336 20.6.4 sim break flag control register . . . . . . . . . . . . . . . . . . . .337 section 21. electrical specifications 21.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 21.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 21.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . .340 21.4 functional operating range. . . . . . . . . . . . . . . . . . . . . . . . . . 341 21.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 21.6 dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 343 21.7 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 21.8 control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 21.9 timer interface module characteristics . . . . . . . . . . . . . . . . . 346 21.10 clock generation module component specifications . . . . . . 347 21.11 cgm operating conditions. . . . . . . . . . . . . . . . . . . . . . . . . . .347 21.12 cgm acquisition/lock time specifications . . . . . . . . . . . .348 21.13 analog-to-digital converter (adc) characteristics. . . . . . . . . 349 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc68hc908mr8 ? rev 4.0 technical data motorola table of contents 19 section 22. mechanical specifications 22.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 22.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 22.3 32-pin lqfp (case #873a) . . . . . . . . . . . . . . . . . . . . . . . . . .352 22.4 28-pin pdip (case #710) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 22.5 28-pin soic (case #751f). . . . . . . . . . . . . . . . . . . . . . . . . . . 353 section 23. ordering information 23.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 23.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 23.3 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 technical data ? revision history contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 changes from rev 3.0 published in april 2002 to rev 4.0 pub- lished in july 2002 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 20 table of contents motorola table of contents f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola list of figures 21 technical data ? mc68hc908mr8 list of figures figure title page 1-1 mcu block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1-2 qfp and dip/soic pin assignments . . . . . . . . . . . . . . . . .33 1-3 power supply bypassing . . . . . . . . . . . . . . . . . . . . . . . . . . .34 2-1 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2-2 control, status, and data registers. . . . . . . . . . . . . . . . . . . 41 4-1 flash control register (flcr) . . . . . . . . . . . . . . . . . . . . . 57 4-2 flash programming algorithm . . . . . . . . . . . . . . . . . . . . . . 61 4-3 flash block protect register (flbpr) . . . . . . . . . . . . . . . 63 4-4 flash block protect address . . . . . . . . . . . . . . . . . . . . . . .64 5-1 config register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 6-1 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6-2 accumulator (a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 6-3 index register (h:x). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6-4 stack pointer (sp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 6-5 program counter (pc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6-6 condition code register (ccr) . . . . . . . . . . . . . . . . . . . . . . 76 7-1 sim block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 7-2 sim i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . . 92 7-3 cgm clock signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 7-4 external reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7-5 internal reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 7-6 sources of internal reset. . . . . . . . . . . . . . . . . . . . . . . . . . . 96 7-7 por recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7-8 interrupt entry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 7-9 interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 7-10 interrupt recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 7-11 interrupt recognition example . . . . . . . . . . . . . . . . . . . . . .103 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 22 list of figures motorola list of figures 7-12 wait mode entry timing . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7-13 wait recovery from interrupt or break. . . . . . . . . . . . . . . . 105 7-14 wait recovery from internal reset . . . . . . . . . . . . . . . . . . 105 7-15 sim break status register (sbsr) . . . . . . . . . . . . . . . . . .106 7-16 sim reset status register (srsr) . . . . . . . . . . . . . . . . . . 108 7-17 sim break flag control register (sbfcr) . . . . . . . . . . . .109 8-1 cgm block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 8-2 cgm i/o register summary . . . . . . . . . . . . . . . . . . . . . . . 115 8-3 cgm external connections . . . . . . . . . . . . . . . . . . . . . . . . 123 8-4 cgm i/o register summary . . . . . . . . . . . . . . . . . . . . . . . 125 8-5 pll control register (pctl) . . . . . . . . . . . . . . . . . . . . . . . 126 8-6 pll bandwidth control register (pbwc) . . . . . . . . . . . . . 129 8-7 pll programming register (ppg) . . . . . . . . . . . . . . . . . . . 131 9-1 pwm module block diagram . . . . . . . . . . . . . . . . . . . . . . . 141 9-2 register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 9-3 center-aligned pwm (positive polarity). . . . . . . . . . . . . . .147 9-4 edge-aligned pwm (positive polarity) . . . . . . . . . . . . . . . . 147 9-5 reload frequency change . . . . . . . . . . . . . . . . . . . . . . . . 149 9-6 pwm interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . .150 9-7 center-aligned pwm value loading . . . . . . . . . . . . . . . . . 150 9-8 center-aligned loading of modulus . . . . . . . . . . . . . . . . . . 151 9-9 edge-aligned pwm value loading . . . . . . . . . . . . . . . . . . 151 9-10 edge-aligned modulus loading . . . . . . . . . . . . . . . . . . . . . 151 9-11 complementary pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 9-12 typical ac motor drive . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 9-13 dead-time generators. . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 9-14 effects of dead-time insertion. . . . . . . . . . . . . . . . . . . . . .156 9-15 dead-time at duty cycle boundaries . . . . . . . . . . . . . . . . 156 9-16 dead-time and small pulse widths. . . . . . . . . . . . . . . . . . 157 9-17 pwm polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 9-18 pwm output control register (pwmout) . . . . . . . . . . . .159 9-19 dead-time insertion during outctl = 1 . . . . . . . . . . . . . 160 9-20 dead-time insertion during outctl = 1 . . . . . . . . . . . . . 161 9-21 pwm disabling scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . 162 9-22 pwm disable mapping write-once register (dismap) . . 163 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of figures mc68hc908mr8 ? rev 4.0 technical data motorola list of figures 23 9-23 pwm disabling decode scheme . . . . . . . . . . . . . . . . . . . . 164 9-24 pwm disabling in automatic mode . . . . . . . . . . . . . . . . . . 166 9-25 pwm disabling in manual mode (example 1) . . . . . . . . . . 167 9-26 pwm disabling in manual mode (example 2) . . . . . . . . . . 167 9-27 pwm software disable . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 9-28 pwmen and pwm pins. . . . . . . . . . . . . . . . . . . . . . . . . . . 169 9-29 pwm counter register high (pcnth) . . . . . . . . . . . . . . . 172 9-30 pwm counter register low (pcnth) . . . . . . . . . . . . . . . . 172 9-31 pwm counter modulo register high (pdmodh) . . . . . . . 173 9-32 pwm counter modulo register low (pdmodl) . . . . . . . .173 9-33 pwmx value registers high (pvalxh) . . . . . . . . . . . . . . .174 9-34 pwmx value registers low (pvalxl) . . . . . . . . . . . . . . . 174 9-35 pwm control register 1 (pctl1) . . . . . . . . . . . . . . . . . . .175 9-36 pwm control register 2 (pctl2) . . . . . . . . . . . . . . . . . . .177 9-37 dead-time write-once register (deadtm) . . . . . . . . . . . 179 9-38 pwm disable mapping write-once register (dismap) . . 179 9-39 fault control register (fcr) . . . . . . . . . . . . . . . . . . . . . . . 180 9-40 fault status register (fsr) . . . . . . . . . . . . . . . . . . . . . . . . 181 9-41 fault acknowledge register (ftack) . . . . . . . . . . . . . . . . 182 9-42 pwm output control register (pwmout) . . . . . . . . . . . .184 9-43 pwm clock cycle and pwm cycle definitions . . . . . . . . . 186 9-44 pwm load cycle/frequency definition . . . . . . . . . . . . . . . 186 10-1 monitor mode circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 10-2 monitor data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 10-3 sample monitor waveforms . . . . . . . . . . . . . . . . . . . . . . . .191 10-4 read transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10-5 break transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10-6 monitor mode entry timing . . . . . . . . . . . . . . . . . . . . . . . . 196 11-1 tima block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 11-2 tima i/o register summary . . . . . . . . . . . . . . . . . . . . . . . 201 11-3 pwm period and pulse width . . . . . . . . . . . . . . . . . . . . . . 208 11-4 tima status and control register (tasc). . . . . . . . . . . . . 214 11-5 tima counter registers (tacnth and tacntl). . . . . . . 216 11-6 tima counter modulo registers (tmodh and tmodl). . 217 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 24 list of figures motorola list of figures 11-7 tima channel status and control registers (tasc0 ? tasc1) 218 11-8 chxmax latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 11-9 tima channel registers (tach0h/l ? tach1h/l) . . . . . . 222 12-1 timb block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 12-2 timb i/o register summary . . . . . . . . . . . . . . . . . . . . . . . 225 12-3 pwm period and pulse width . . . . . . . . . . . . . . . . . . . . . . 232 12-4 timb status and control register (tbsc). . . . . . . . . . . . . 238 12-5 timb counter registers (tbcnth and tbcntl). . . . . . . 240 12-6 timb counter modulo registers (tmodh and tmodl). . 241 12-7 timb channel status and control registers (tbsc0 ? tbsc1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 12-8 chxmax latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 12-9 timb channel registers (tbch0h/l ? tbch1h/l) . . . . . . 246 13-1 sci module block diagram . . . . . . . . . . . . . . . . . . . . . . . . 250 13-2 sci i/o register summary. . . . . . . . . . . . . . . . . . . . . . . . . 251 13-3 sci data formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 13-4 sci transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254 13-5 sci receiver block diagram . . . . . . . . . . . . . . . . . . . . . . . 256 13-6 receiver data sampling. . . . . . . . . . . . . . . . . . . . . . . . . . . 258 13-7 sci control register 1 (scc1) . . . . . . . . . . . . . . . . . . . . . 264 13-8 sci control register 2 (scc2) . . . . . . . . . . . . . . . . . . . . . 267 13-9 sci control register 3 (scc3) . . . . . . . . . . . . . . . . . . . . . 270 13-10 sci status register 1 (scs1) . . . . . . . . . . . . . . . . . . . . . . 271 13-11 flag clearing sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . 274 13-12 sci status register 2 (scs2) . . . . . . . . . . . . . . . . . . . . . . 275 13-13 sci data register (scdr). . . . . . . . . . . . . . . . . . . . . . . . . 276 13-14 sci baud rate register (scbr) . . . . . . . . . . . . . . . . . . . . 276 14-1 i/o port register summary . . . . . . . . . . . . . . . . . . . . . . . . 280 14-2 port a data register (pta) . . . . . . . . . . . . . . . . . . . . . . . . 281 14-3 data direction register a (ddra) . . . . . . . . . . . . . . . . . . . 282 14-4 port a i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 14-5 port b data register (ptb) . . . . . . . . . . . . . . . . . . . . . . . . 284 14-6 data direction register b (ddrb) . . . . . . . . . . . . . . . . . . . 285 14-7 port b i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of figures mc68hc908mr8 ? rev 4.0 technical data motorola list of figures 25 14-8 port c data register (ptc) . . . . . . . . . . . . . . . . . . . . . . . . 287 14-9 data direction register c (ddrc). . . . . . . . . . . . . . . . . . . 288 14-10 port c i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 15-1 cop block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 15-2 cop i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . 292 15-3 cop control register (copctl). . . . . . . . . . . . . . . . . . . . 294 16-1 irq module block diagram . . . . . . . . . . . . . . . . . . . . . . . . 298 16-2 irq i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . 298 16-3 irq interrupt flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 16-4 irq status and control register (iscr) . . . . . . . . . . . . . . 303 17-1 lvi module block diagram. . . . . . . . . . . . . . . . . . . . . . . . . 306 17-2 lvi i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . . 307 17-3 lvi status and control register (lviscr) . . . . . . . . . . . .308 18-1 adc block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 18-2 8-bit truncation mode error . . . . . . . . . . . . . . . . . . . . . . . . 316 18-3 adc status and control register (adscr). . . . . . . . . . . . 319 18-4 adc data register high (adrh) left justified mode . . . . 322 18-5 adc data register high (adrh) right justified mode . . . 322 18-6 adc data register low (adrl) left justified mode . . . . .323 18-7 adc data register low (adrl) right justified mode. . . . 323 18-8 adc data register low (adrl) 8-bit mode . . . . . . . . . . . 324 18-9 adc clock register (adclk) . . . . . . . . . . . . . . . . . . . . . . 324 20-1 break module block diagram. . . . . . . . . . . . . . . . . . . . . . . 331 20-2 i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 20-3 break status and control register (brkscr) . . . . . . . . . 333 20-4 break address register high (brkh) . . . . . . . . . . . . . . . . 334 20-5 break address register low (brkl) . . . . . . . . . . . . . . . . . 335 20-6 sim break status register (sbsr) . . . . . . . . . . . . . . . . . . 336 20-7 example code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 20-8 sim break flag control register (sbfcr) . . . . . . . . . . . .337 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 26 list of figures motorola list of figures f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola list of tables 27 technical data ? mc68hc908mr8 list of tables table title page 2-1 vector addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 6-1 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6-2 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7-1 signal name conventions . . . . . . . . . . . . . . . . . . . . . . . . . . .92 7-2 pin bit set timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 8-1 vco frequency multiplier (n) selection. . . . . . . . . . . . . . . . 131 9-1 pwm prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9-2 pwm reload frequency . . . . . . . . . . . . . . . . . . . . . . . . . . .149 9-3 pwm data overflow and underflow conditions. . . . . . . . . . 152 9-4 outx bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 9-5 pwm reload frequency . . . . . . . . . . . . . . . . . . . . . . . . . . .177 9-6 pwm prescaler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 9-7 outx bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 10-1 mode selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10-2 mode differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 10-3 read (read memory) command . . . . . . . . . . . . . . . . . . . . 193 10-4 write (write memory) command. . . . . . . . . . . . . . . . . . . . 193 10-5 iread (indexed read) command . . . . . . . . . . . . . . . . . . . . 194 10-6 iwrite (indexed write) command . . . . . . . . . . . . . . . . . . .194 10-7 readsp (read stack pointer) command. . . . . . . . . . . . . . 195 10-8 run (run user program) command. . . . . . . . . . . . . . . . . . 195 11-1 prescaler selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 11-2 mode, edge, and level selection. . . . . . . . . . . . . . . . . . . . . 220 12-1 prescaler selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 12-2 mode, edge, and level selection. . . . . . . . . . . . . . . . . . . . . 244 13-1 start bit verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 13-2 data bit recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 13-3 stop bit recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 13-4 character format selection . . . . . . . . . . . . . . . . . . . . . . . . . 266 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 28 list of tables motorola list of tables 13-5 sci baud rate prescaling . . . . . . . . . . . . . . . . . . . . . . . . . .277 13-6 sci baud rate selection . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 13-7 sci baud rate selection examples . . . . . . . . . . . . . . . . . . . 278 14-1 port a pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 14-2 port b pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 14-3 port c pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 17-1 lviout bit indication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 18-1 mux channel select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 18-2 adc clock divide ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 23-1 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola general description 29 technical data ? mc68hc908mr8 section 1. general description 1.1 contents 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.5.1 power supply pins (v dd and v ss ) . . . . . . . . . . . . . . . . . . 34 1.5.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . . 34 1.5.3 external reset pin (rst) . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.5.4 external interrupt pin (irq) . . . . . . . . . . . . . . . . . . . . . . . . 35 1.5.5 cgm power supply pins (v dda and v ssa ) . . . . . . . . . . . . 35 1.5.6 adc reference voltage input pin (v refh ) . . . . . . . . . . . . 35 1.5.7 external filter capacitor pin (cgmxfc) . . . . . . . . . . . . . 35 1.5.8 port a input/output (i/o) pins (pta6/atd6 ? pta0/atd0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 1.5.9 port b i/o pins (ptb6/tchb1 ? ptb0/rxd) . . . . . . . . . . . . 36 1.5.10 port c i/o pins (ptc1/fault1 ? ptc0/fault4) . . . . . . . . 36 1.5.11 pwm pins (pwm6 ? pwm1) . . . . . . . . . . . . . . . . . . . . . . . . . 36 1.2 introduction the mc68hc908mr8 is a member of the low-cost, high-performance m68hc08 family of 8-bit microcontroller units (mcu). the m68hc08 family is based on the customer-specified integrated circuit (csic) design strategy. all mcus in the family use the enhanced m68hc08 central processor unit (cpu08) and are available with a variety of modules, memory sizes and types, and package types. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 30 general description motorola general description 1.3 features features of the mc68hc908mr8 include:  high-performance m68hc08 architecture  fully upward-compatible object code with m6805, m146805, and m68hc05 families  8-mhz internal bus frequency  8 kbytes of on-chip flash  on-chip programming firmware for use with host personal computer  256 bytes of on-chip random-access memory (ram):  12-bit, 6-channel center-aligned or edge-aligned pulse-width modulator (pwmmc)  serial communications interface module (sci)  two 16-bit, 2-channel timer interface modules (tima and timb)  eight high current sink and source pins (pta1/atd1, pta0/atd0, ptb6/tch1b, ptb5/tch0b, ptb4/tch1a, ptb3/tch0a, ptb2/tclka, and ptb1/txd)  clock generator module (cgm)  digitally filtered low-voltage inhibit (lvi), software selectable for 5 percent or 10 percent tolerance  10-bit, 4 to 7-channel analog-to-digital converter (adc)  system protection features: ? optional computer operating properly (cop) reset ? low-voltage detection with optional reset ? illegal opcode detection with optional reset ? illegal address detection with optional reset ? fault detection with optional pwm disabling f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description mcu block diagram mc68hc908mr8 ? rev 4.0 technical data motorola general description 31  available packages: ? 32-pin low-profile quad flat pack (lqfp) ? 28-pin dual in-line package (pdip) ? 28-pin small outline package (soic)  low-power design, fully static with stop and wait modes  break (brk) module allows single breakpoint setting during in-circuit debugging  master reset pin and power-on reset (por) features of the cpu08 include:  enhanced hc05 programming model  extensive loop control functions  16 addressing modes (eight more than the m68hc05)  16-bit index register and stack pointer  memory-to-memory data transfers  fast 8  fast 16  binary-coded decimal (bcd) instructions  optimization for controller applications  c language support 1.4 mcu block diagram figure 1-1 shows the structure of the mc68hc908mr8. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 32 general description motorola general description figure 1-1. mcu block diagram clock generator module system integration module serial communications interface module timer a and timer b interface modules low-voltage inhibit module power-on reset module computer operating properly module arithmetic/logic unit (alu) cpu registers m68hc08 cpu control and status registers ? 112 bytes user ram ? 256 bytes monitor rom ? 313 bytes user vector space ? 46 bytes irq module power internal bus osc1 osc2 cgmxfc rst irq v ss v dd v dda pulse-width modulator module analog-to-digital converter module v ssa pta0/atd0 pta1/atd1 pta2/atd2 pta3/atd3 pta4/atd4 pta5/atd5 ddra pta ptb6/tch1b ptb5/tch0b ptb4/tch1a ptb3/tch0a ptb2/tclka ptb1/txd ptb0/rxd ddrb ptb pwm6 pwm5 pwm4 pwm3 pwm2 pwm1 ptc1/fault4 ptc0/fault1 pta6/atd6 v refh pulse-width modulator break module user flash ? 7680 bytes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description pin assignments mc68hc908mr8 ? rev 4.0 technical data motorola general description 33 1.5 pin assignments figure 1-2 shows 32-pin qfp and 28-pin dip/soic pin assignments. figure 1-2. qfp and dip/soic pin assignments 1 2 3 4 5 6 7 8 9 10 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 11 12 13 14 15 16 pta1/atd1 pta2/atd2 pta3/atd3 pta4/atd4 pta5/atd5 ptb0/rxd ptb1/txd ptb2/tclka ptb3/tch0a ptb4/tch1a ptb5/tch0b ptb6/tch1b ptc0/fault1 ptc1/fault4 pwm1 pwm2 pwm3 pwm4 pwm5 pwm6 32-pin qfp 1 2 3 6 7 8 9 10 11 12 13 14 4 5 28 27 26 25 24 23 22 21 20 19 18 17 16 15 pta0/atd0 pta1/atd1 pta2/atd2 pta3/atd3 ptb0/rxd ptb1/txd ptb2/tclka ptb3/tch0a ptb4/tch1a pwm1 pwm2 pwm3 pwm4 pwm5 pwm6 28-pin pta6/atd6 pta0/atd0 irq rst v ssa cgmxfc v dda irq rst cgmxfc v ss v dd osc2 osc1 osc2 osc1 v ss v dd v ssa v dda o o v refh v refh ptc0/fault1 ptb5/tch0b * high current pins * ptb6/tch1b * * * * ** these pins are not bonded on the 28-pin package. ** ** ** ** dip/soic f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 34 general description motorola general description 1.5.1 power supply pins (v dd and v ss ) v dd and v ss are the power supply and ground pins. the mcu operates from a single power supply. fast signal transitions on mcu pins place high, short-duration current demands on the power supply. to prevent noise problems, take special care to provide power supply bypassing at the mcu as figure 1-3 shows. place the c1 bypass capacitor as close to the mcu as possible. use a high-frequency-response ceramic capacitor for c1. c2 is an optional bulk current bypass capacitor for use in applications that require the port pins to source high current levels. figure 1-3. power supply bypassing 1.5.2 oscillator pins (osc1 and osc2) the osc1 and osc2 pins are the connections for the on-chip oscillator circuit. see section 8. clock generator module (cgm) . 1.5.3 external reset pin (rst ) a logic 0 on the rst pin forces the mcu to a known startup state. rst is bidirectional, allowing a reset of the entire system. it is driven low when any internal reset source is asserted. see section 7. system integration module (sim) . mcu v dd c2 c1 0.1 f v ss v dd + note: component values shown represent typical applications. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description pin assignments mc68hc908mr8 ? rev 4.0 technical data motorola general description 35 1.5.4 external interrupt pin (irq ) irq is an asynchronous external interrupt pin. see section 16. external interrupt (irq) . 1.5.5 cgm power supply pins (v dda and v ssa ) v dda and v ssa are the power supply pins for the analog portion of the clock generator module (cgm) and the analog-to-digital converter (adc). decoupling of these pins should be per the digital supply. see section 8. clock generator module (cgm) and section 18. analog-to-digital converter (adc) . 1.5.6 adc reference voltage input pin (v refh ) v refh is the power supply input for setting the reference voltage. see section 18. analog-to-digital converter (adc) . 1.5.7 external filter capacitor pin (cgmxfc) cgmxfc is an external filter capacitor connection for the cgm. see section 8. clock generator module (cgm) . 1.5.8 port a input/output (i/o) pins (pta6/atd6 ? pta0/atd0) port a is a 7-bit special function port, sharing all of its pins with the analog-to-digital converter (adc). on the 32-pin qfp package, all seven bits (pta6/atd6 ? pta0/atd0) of the port are available. on the 28-pin package, four bits (pta3/atd3 ? pta0/atd0) are available. pta3 ? pta0 have high current source and sink capability. see section 14. input/output (i/o) ports . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 36 general description motorola general description 1.5.9 port b i/o pins (ptb6/tchb1 ? ptb0/rxd) port b is a 7-bit special function port, sharing five of its pins with the timer interface modules (tima and timb) and two of its pins with the serial communications interface (sci). see section 11. timer interface a (tima) , section 12. timer interface b (timb) , section 14. input/output (i/o) ports , and section 13. serial communications interface (sci) . 1.5.10 port c i/o pins (ptc1/fault1 ? ptc0/fault4) port c is a 2-bit special function port, sharing its pins with pulse-width modulator fault inputs. see section 9. pulse-width modulator for motor control (pwmmc) and section 14. input/output (i/o) ports . 1.5.11 pwm pins (pwm6 ? pwm1) pwm6 ? pwm1 are dedicated pins used for the outputs of the pulse- width modulator module (pwmmc). see section 9. pulse-width modulator for motor control (pwmmc) . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola memory map 37 technical data ? mc68hc908mr8 section 2. memory map 2.1 contents 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.3 unimplemented memory locations . . . . . . . . . . . . . . . . . . . 38 2.4 reserved memory locations . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.5 i/o section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.6 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 2.2 introduction the central processor unit (cpu08) can address 64 kbytes of memory space. the memory map, shown in figure 2-1 , includes these features:  8 kbytes of flash  256 bytes of ram  313 bytes of monitor rom  46 bytes of user-defined vectors f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 38 memory map motorola memory map 2.3 unimplemented memory locations some addresses are unimplemented. accessing an unimplemented address will cause an illegal address reset. in the memory map and in the input/output (i/o) register summary, unimplemented addresses are shaded. some i/o bits are read-only; the write function is unimplemented. writing to a read-only i/o bit has no effect on mcu operation. in register figures, the write function of read-only bits is shaded. similarly, some i/o bits are write-only; the read function is unimplemented. reading of write-only i/o bits has no effect on microcontroller unit (mcu) operation. in register figures, the read function of write-only bits is shaded. 2.4 reserved memory locations some addresses are reserved. writing to a reserved address can have unpredictable effects on mcu operation. in the memory map and in the i/o register summary, reserved addresses are marked with the word reserved. some i/o bits are reserved. writing to a reserved bit can have unpredictable effects on mcu operation. in register figures, reserved bits are marked with the letter r. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 39 2.5 i/o section addresses $0000 ? $005f, shown in figure 2-2 , contain most of the control, status, and data registers. additional i/o registers have these addresses:  $fe00, system integration module (sim) break status register (sbsr)  $fe01, sim reset status register (srsr)  $fe03, sim break flag control register (sbfcr)  $fe08, flash control register (flcr)  $ff57, flash test control register (fltcr)  $fe0c, break address register high (brkh)  $fe0d, break flag control register low (brkl)  $fe0e, break status and control register (brkscr)  $fe0f, low-voltage inhibit (lvi) status and control register (lviscr)  $ff7e, flash block protect register (flbpr)  $ffff, computer operating properly (cop) control register (copctl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 40 memory map motorola memory map mc68hc908mr8 $0000 i/o registers ? 96 bytes $0000 ? 256 bytes $0060 ? 56,992 bytes $0160 ? 7,680 bytes $e000 $ee00 ? 313 bytes $fe10 ? 53 bytes $ff49 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 41 $ff7e flash block protect register (flbpr) $ff7e $ff7f unimplemented ? 83 bytes $ff7f ? 45 bytes (46 including $ffff) $ffd2 r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 1 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 42 memory map motorola memory map $0005 data direction register b (ddrb) see page 284. read: u ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset: u0 0 0 0 0 0 0 $0006 data direction register c (ddrc) see page 288. read: ddrc1 ddrc0 write: reset: uu u u u u 0 0 $0007 unimplemented r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 2 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 43 $0014 tima channel 0 regis- ter high (tach0h) see page 222. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $0015 tima channel 0 regis- ter low (tach0l) see page 218. read: bit 7 6 5 4 3 2 1 bit 0 write: reset: indeterminate after reset $0016 tima channel 1 sta- tus/control register (tasc1) see page 222. read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write: 0 r reset: 0 0 0 0 0 0 0 0 $0017 tima channel 1 regis- ter high (tach1h) see page 222. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $0018 tima channel 1 regis- ter low (tach1l) see page 222. read: bit 7 6 5 4 3 2 1 bit 0 write: reset: indeterminate after reset $0019 unimplemented r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 3 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 44 memory map motorola memory map $0022 fault control register (fcr) see page 180. read: fint4 fmode 4 fint1 fmode 1 write: reset: 0 0 0 0 0 0 0 0 $0023 fault status register (fsr) see page 181. read: fpin4 fflag 4 00 0 0fpin1 fflag 1 write: reset: u0 u 0 u 0 u 0 $0024 fault acknowledge reg- ister (ftack) see page 182. read: 00 0 0 0 0 0 0 write: ftack 4 ftack 1 reset: 0 0 0 0 0 0 0 0 $0025 pwm output control (pwmout) see page 159. read: 0 out- ctl out6 out5 out4 out3 out2 out1 write: reset: 0 0 0 0 0 0 0 0 $0026 pwm counter register high (pcnth) see page 172. read: 0 0 0 0 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $0027 pwm counter register low (pcntl) see page 172. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0028 pwm counter modulo register high (pmodh) see page 173. read: 00 0 0 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 x x x x $0029 pwm counter modulo register low (pmodl) see page 173. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: x x x x x x x x $002a pwm 1 value register high (pval1h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 4 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 45 $002b pwm 1 value register low (pval1l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $002c pwm 2 value register high (pval2h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $002d pwm 2 value register low (pval2l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $002e pwm 3 value register high (pval3h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $002f pwm 3 value register low (pval3l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0030 pwm 4 value register high (pval4h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $0031 pwm 4 value register low (pval4l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0032 pwm 5 value register high (pmval5h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $0033 pwm 5 value register low (pval5l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0034 pwm 6 value register high (pval6h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 5 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 46 memory map motorola memory map $0035 pwm 6 value register low (pmval6l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0036 dead-time write-once register (deadtm) see page 179. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 $0037 pwm disable mapping write-once register (dismap) see page 179. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 $0038 sci control register 1 (scc1) see page 264. read: loop s ensci txinv m wake ilty pen pty write: reset: 0 0 0 0 0 0 0 0 $0039 sci control register 2 (scc2) see page 267. read: sctie tcie scrie ilie te re rwu sbk write: reset: 0 0 0 0 0 0 0 0 $003a sci control register 3 (scc3) see page 270. read: r8 t8 00 orie neie feie peie write: r r r reset: u u 0 0 0 0 0 0 $003b sci status register 1 (scs1) see page 271. read: scte tc scrf idle or nf fe pe write: r r r r r r r r reset: 1 1 0 0 0 0 0 0 $003c sci status register 2 (scs2) see page 275. read: 0 0 0 0 0 0 bkf rpf write: r r r r r r r r reset: 0 0 0 0 0 0 0 0 $003d sci data register (scdr) see page 276. read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset $003e sci baud rate register (scbr) see page 276. read: 0 0 scp1 scp0 0 scr2 scr1 scr0 write: r r r reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 6 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 47 $003f irq status/control reg- ister (iscr) see page 303. read: 0 0 0 0 irqf 0 imask1 mode1 write: r r r r ack1 reset: 0 0 0 0 0 0 0 0 $0040 adc status and control register (adscr) see page 319. read: coco aien adco adch4 adch3 adch2 adch1 adch0 write: reset: 0 0 0 1 1 1 1 1 $0041 adc data register high (adrh) see page 322. read: 0 0 0 0 0 0 ad9 ad8 write: r r r r r r r r reset: unaffected by reset $0042 adc data register low (adrl) see page 323. read: ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 write: r r r r r r r r reset: unaffected by reset $0043 adc clock register (adclk) see page 324. read: adiv2 adiv1 adiv0 adiclk mode1 mode0 0 0 write: r reset: 0 0 0 0 0 1 0 0 $0044 unimplemented r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 7 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 48 memory map motorola memory map $0055 timb counter modulo register low (tbmodl) see page 241. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 $0056 timb channel 0 sta- tus/control register (tbsc0) see page 242. read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0ma x write: 0 reset: 0 0 0 0 0 0 0 0 $0057 timb channel 0 regis- ter high (tbch0h) see page 246. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $0058 timb channel 0 regis- ter low (tbch0l) see page 246. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset $0059 timb channel 1 sta- tus/control register (tbsc1) see page 242. read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write: 0 r reset: 0 0 0 0 0 0 0 0 $005a timb channel 1 regis- ter high (tbch1h) see page 246. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $005b timb channel 1 regis- ter low (tbch1l) see page 246. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset $005c pll control register (pctl) see page 126. read: pllie pllf pllon bcs 1111 write: r r r r r reset: 0 0 1 0 1 1 1 1 $005d pll bandwidth control register (pbwc) see page 129. read: auto lock acq xld 0000 write: r r r r r reset: 0 0 0 0 0 0 0 0 $005e pll programming reg- ister (ppg) see page 131. read: mul7 mul6 mul5 mul4 vrs7 vrs6 vrs5 vrs4 write: reset: 0 1 1 0 0 1 1 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 8 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 49 $005f reserved r r r r r r r r $fe00 sim break status regis- ter (sbsr) see page 336. read: rr r r r r sbsw r write: note (1) reset: 0 note 1. writing a logic 0 clears sbsw. $fe01 sim reset status regis- ter (srsr) see page 108. read: por pin cop ilop ilad 0 lvi 0 write: r r r r r r r r reset: 1 0 0 0 0 0 0 0 $fe03 sim break flag control register (sbfcr) see page 109. read: bcfe r r r r r r r write: reset: 0 $fe08 flash control register (flcr) see page 57. read: 00 0 0 hven mass erase pgm write: reset: 0 0 0 0 0 0 0 0 $fe0a reserved r r r r r r r r $fe0b unimplemented $fe0c break address register high (brkh) see page 334. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $fe0d break address register low (brkl) see page 334. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $fe0e break status and con- trol register (brkscr) see page 333. read: brke brka 00 0 000 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 9 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 50 memory map motorola memory map $fe0f lvi status and control register (lviscr) see page 308. read: lvi- out 0 trps- el 00000 write: r r r r r r r reset: 0 0 0 0 0 0 0 0 $ff7e flash block protect register (flbpr) see page 63. read: bpr7 bpr6 bpr5 bpr4 bpr3 bpr2 bpr1 bpr0 write: reset: unaffected by reset $ffff cop control register (copctl) see page 294. read: low byte of reset vector write: clear cop counter reset: unaffected by reset addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indetermi- nate r = reserved bold = buff- ered = unimplemented figure 2-2. control, status, and data registers (sheet 10 of 10) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
memory map i/o section mc68hc908mr8 ? rev 4.0 technical data motorola memory map 51 table 2-1 is a list of vector locations. table 2-1. vector addresses address vector low $ffd2 sci transmit vector (high) $ffd3 sci transmit vector (low) $ffd4 sci receive vector (high) $ffd5 sci receive vector (low) $ffd6 sci error vector (high) $ffd7 sci error vector (low) $ffd8 reserved $ffd9 reserved $ffda reserved $ffdb reserved $ffdc a/d vector (high) $ffdd a/d vector (low) $ffde timb overflow vector (high) $ffdf timb overflow vector (low) $ffe0 timb channel 1 vector (high) $ffe1 timb channel 1 vector (low) $ffe2 timb channel 0 vector (high) $ffe3 timb channel 0 vector (low) $ffe4 tima overflow vector (high) $ffe5 tima overflow vector (low) $ffe6 reserved $ffe7 reserved $ffe8 reserved $ffe9 reserved $ffea tima channel 1 vector (high) $ffeb tima channel 1 vector (low) $ffec tima channel 0 vector (high) $ffed tima channel 0 vector (low) priority f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 52 memory map motorola memory map 2.6 monitor rom 313 bytes at addresses $fe10 ? $ff48 are reserved rom addresses that contain the instructions for the monitor functions. see section 10. monitor rom (mon) . $ffee pwmmc vector (high) $ffef pwmmc vector (low) $fff0 fault 4 (high) $fff1 fault 4 (low) $fff2 reserved $fff3 reserved $fff4 reserved $fff5 reserved $fff6 fault 1 (high) $fff7 fault 1 (low) $fff8 pll vector (high) $fff9 pll vector (low) $fffa irq vector (high) $fffb irq vector (low) $fffc swi vector (high) $fffd swi vector (low) high $fffe reset vector (high) $ffff reset vector (low) table 2-1. vector addresses (continued) address vector priority f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola random-access memory (ram) 53 technical data ? mc68hc908mr8 section 3. random-access memory (ram) 3.1 contents 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.2 introduction this section describes the 256 bytes of random-access memory (ram) on the mc68hc908mr8. 3.3 functional description addresses $0060 ? $015f are ram locations. the location of the stack ram is programmable. the 16-bit stack pointer allows the stack to be anywhere in the 64-kbyte memory space. note: for correct operation, the stack pointer must point only to ram locations. within page zero are 160 bytes of ram. because the location of the stack ram is programmable, all page zero ram locations can be used for input/output (i/o) control and user data or code. when the stack pointer is moved from its reset location at $00ff, direct addressing mode instructions can access efficiently all page zero ram locations. page zero ram, therefore, provides ideal locations for frequently accessed global variables. before processing an interrupt, the cpu uses five bytes of the stack to save the contents of the central processor unit (cpu) registers. note: for m6805 compatibility, the h register is not stacked. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 54 random-access memory (ram) motorola random-access memory (ram) during a subroutine call, the cpu uses two bytes of the stack to store the return address. the stack pointer decrements during pushes and increments during pulls. note: be careful when using nested subroutines. the cpu may overwrite data in the ram during a subroutine or during the interrupt stacking operation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 55 technical data ? mc68hc908mr8 section 4. flash memory 4.1 contents 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.2.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.2.2 flash control register . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.2.3 flash page erase operation . . . . . . . . . . . . . . . . . . . . . . 58 4.2.4 flash mass erase operation . . . . . . . . . . . . . . . . . . . . . . 59 4.2.5 flash program/read operation . . . . . . . . . . . . . . . . . . . 59 4.3 flash programming algorithm . . . . . . . . . . . . . . . . . . . . . . 60 4.3.1 flash block protection . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.3.2 flash block protect register . . . . . . . . . . . . . . . . . . . . . 63 4.3.3 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.2 introduction this section describes the operation of the mc68hc908mr8 embedded flash memory. this memory can be read, programmed, and erased from a single external supply. the program and erase operations are enabled through the use of an internal charge pump. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 56 flash memory motorola flash memory 4.2.1 functional description the flash memory physically consists of an array of 7680 bytes with an additional 46 bytes of user vectors and one byte of block protection. an erased bit reads as a logic 1 and a programmed bit reads as a logic 0. program and erase operations are facilitated through control bits in a memory mapped register. details for these operations appear later in this section. memory in the flash array is organized into two rows per page base. for the 8-k word by 8-bit embedded flash memory, the page size is 64 bytes per page. the minimum erase page size is 64 bytes. program and erase operations are performed through control bits in the flash control register (flcr). the address ranges for the user memory, control register, and vectors are:  $e000 ? $fdff, user memory  $ff7e, block protect register (flbpr)  $fe08, flash control register (flcr)  $ffd2 ? $ffff, locations reserved for user-defined interrupt and reset vectors programming tools are available from motorola. contact a local motorola representative for more information. note: a security feature 1 prevents viewing of the flash contents. 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the flash difficult for unauthorized users. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash memory introduction mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 57 4.2.2 flash control register the flash control register (flcr) controls the flash program, erase, and read operations. hven ? high-voltage enable bit this read/write bit enables the charge pump to drive high voltages for program and erase operations in the array. hven can be set only if either pgm = 1 or erase = 1 and the proper sequence for program/margin read or erase is followed. 1 = high voltage enabled to array and charge pump on 0 = high voltage disabled to array and charge pump off mass ? mass erase control bit this read/write bit configures the memory for mass erase operation. 1 = mass erase operation selected 0 = mass erase operation unselected erase ? erase control bit this read/write bit configures the memory for erase operation. erase is interlocked with the pgm bit such that both bits cannot be set at the same time. 1 = erase operation selected 0 = erase operation unselected ad- dress: $fe08 bit 7654321bit 0 read: 0 0 0 0 hven mass erase pgm write: reset:00000000 = unimplemented figure 4-1. flash control register (flcr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 58 flash memory motorola flash memory pgm ? program control bit this read/write bit configures the memory for program operation. pgm is interlocked with the erase bit such that both bits cannot be set at the same time. 1 = program operation selected 0 = program operation unselected 4.2.3 flash page erase operation use this step-by-step procedure to erase a page (64 bytes) of flash memory to read as logic 1: 1. set the erase bit and clear the mass bit in the flash control register. 2. read the flash block protect register. 3. write to any flash address with any data within the page address range desired. 4. wait for a time, t nvs (minimum of 10 note: while these operations must be performed in the order shown, other unrelated operations may occur between the steps. do not exceed t nvh maximum. see 21.7 memory characteristics . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash memory introduction mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 59 4.2.4 flash mass erase operation use this step-by-step procedure to erase the entire flash memory to read as logic 1: 1. set the erase bit and the mass bit in the flash control register. 2. read the block protect register. 3. write to any flash address with any data within the page address range desired. 4. wait for a time, t nvs (minimum of 10 note: programming and erasing of flash locations cannot be performed by code being executed from the flash memory. while these operations must be performed in the order shown, other unrelated operations may occur between the steps. do not exceed t nvh maximum. see 21.7 memory characteristics . 4.2.5 flash program/read operation programming of the flash memory is done on a row basis. a row consists of 32 consecutive bytes starting from address $xx00, $xx20, $xx40, and $xx80. use this step-by-step procedure to program a row of flash memory: 1. set the pgm bit in the flash control register. this configures the memory for program operation and enables the latching of address and data programming. 2. read the block protect register. 3. write to any flash address with any data within the page f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 60 flash memory motorola flash memory address range desired. 4. wait for a time, t nvs (minimum of 10 note: the time between each flash address change, or the time between the last flash address programmed to clear the pgm bit, must not exceed the maximum programming time, t prog . programming and erasing of flash locations cannot be performed by code being executed from the flash memory. while these operations must be performed in the order shown, other unrelated operations may occur between the steps. do not exceed t prog maximum. see 21.7 memory characteristics . 4.3 flash programming algorithm refer to figure 4-2 for an algorithm for programming a row (32 bytes) of flash memory. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash memory flash programming algorithm mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 61 figure 4-2. flash programming algorithm wait for a time, t pgs set pgm bit wait for a time, t nvs yes no programming operation complete write any data to selected page set hven bit clear pgm bit completed programming this row? read flash block program flash write data to the flash address to be programmed wait for a time, t prog wait for a time, t prog clear hven bit wait for a time, tprog note: this page program algorithm assumes the rows to be programmed are initially erased. protect register note: the time between each address change, or the time between the last flash address programmed to clear the pgm bit, must not exceed the maximum programming time, t prog . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 62 flash memory motorola flash memory 4.3.1 flash block protection due to the ability of the on-board charge pump to erase and program the flash memory in the target application, provision is made for protecting blocks of memory from unintentional erase or program operations due to system malfunction. this protection is done by using a flash protection register (flbpr). the flbpr determines the range of the flash memory which is to be protected. the range of the protected area starts from a location defined by flbpr and ends at the bottom of the flash memory ($ffff). when the memory is protected, the hven bit cannot be set in either erase or program operations. note: in performing a program erase operation, the flash block protect register must be read after setting the pgm or erase bit and before asserting the hven bit. when the block protect register is erased (all 1s), the entire memory is accessible for program and erase. when bits within the register are programmed (set to 0), they lock blocks of memory address ranges as shown in 4.3.2 flash block protect register . once the block protect register is programmed with value other than $ff, any erase or program of the block protect register or the protected pages will be prohibited. the block protect register itself can be erased or programmed only with an external voltage v hi present on the irq pin. the presence of v hi on the irq pin also allows entry into monitor mode out of reset. therefore, the ability to change the block protect register is voltage dependent and can occur in either user or monitor modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash memory flash programming algorithm mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 63 4.3.2 flash block protect register the block protect register (flbpr) is implemented as a byte within the flash memory, and therefore can only be written during a programming sequence of the flash memory. the value in this register determines the starting location of the protected range within the flash memory. bpr[7:0] ? block protect register bits these eight bits represent bits [13:6] of a 16-bit memory address. bits[15:14] are logical 1s and bits [5:0] are logic 0s. the resultant 16-bit address is used for specifying the start address of the flash memory for block protection. the flash is protected from this start address to the end of flash memory at $ffff. with this mechanism, the protect start address can be $xx00, $xx40, $xx80, and $xxc0 (64-byte page boundaries) within the flash memory. ad- dress: $ff7e bit 7654321bit 0 read: bpr7 bpr6 bpr5 bpr4 bpr3 bpr2 bpr1 bpr0 write: reset:uuuuuuuu u= unaffected by reset. initial value from factory is 1. write to this register by a programming sequence to the flash memory. figure 4-3. flash block protect register (flbpr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 64 flash memory motorola flash memory $80 = the entire flash memory is protected. $81 = protected range: $e040 ? $ffff $82 = protected range: $e080 ? $ffff ? $ffff $ff = entire flash memory is not protected. if all bits are erased, then all of the memory is available for erase and program. the presence of a voltage v hi on the irq pin will bypass the block protection so that all of the memory, including the block protect register, is open for program and erase operations. 4.3.3 low-power modes the wait and stop instructions will place the mcu in a low power- consumption standby mode. 4.3.3.1 wait mode putting the mcu into wait mode while the flash is in read mode does not affect the operation of the flash memory directly, but there will not be any memory activity since the cpu is inactive. the wait instruction should never be executed while performing a program or erase operation on the flash. when the mcu is put into wait mode, the charge pump for the flash is disabled so that either a program or erase operation will not continue. if the memory is in either program mode (pgm = 1, hven = 1) or erase mode (erase = 1, hven = 1), then it will remain in that mode during wait. note: exiting from wait must now be done with a reset rather than an interrupt because if exiting wait with an interrupt, the memory will not be in read mode and the interrupt vector cannot be read from the memory. 16-bit memory address start address of flash block protect 11 flbpr value 000000 figure 4-4. flash block protect address f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash memory flash programming algorithm mc68hc908mr8 ? rev 4.0 technical data motorola flash memory 65 4.3.3.2 stop mode if the flash is in read mode, when the mcu is put into stop mode, the flash will be put into low-power standby mode. the stop instruction should never be executed while performing a program or erase operation on the flash. otherwise the operation will be discontinued and the flash will be in standby mode. note: standby mode is the power-saving mode of the flash module, in which all internal control signals to the flash are inactive and the current consumption of the flash is minimum. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 66 flash memory motorola flash memory f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola configuration register (config) 67 technical data ? mc68hc908mr8 section 5. configuration register (config) 5.1 contents 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.3 config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4 config bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.2 introduction this section describes the configuration register (config). the config registers contain bits that configure these options:  resets caused by the low-voltage inhibit (lvi) module  power to the lvi module  computer operating properly (cop) module  top-side pulse-width modulator (pwm) polarity  bottom-side pwm polarity  edge-aligned versus center-aligned pwms  six independent pwms versus three complementary pwm pairs  stop instruction enable f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 68 configuration register (config) motorola configuration register (config) 5.3 config the configuration register (config) is a write-once register. once the register is written, further writes will have no effect until a reset occurs. 5.4 config bits note: if the lvi module and the lvi reset signal are enabled, a reset occurs when v dd falls to a voltage, lvi tripf , and remains at or below that level for at least nine consecutive central processor unit (cpu) cycles. once an lvi reset occurs, the microcontroller unit (mcu) remains in reset until v dd rises to a voltage, lvi tripr . edge ? edge-align enable bit edge determines if the motor control pwm will operate in edge-aligned mode or center-aligned mode. see section 9. pulse-width modulator for motor control (pwmmc) . 1 = edge-aligned mode enabled 0 = center-aligned mode enabled botneg ? bottom-side pwm polarity bit botneg determines if the bottom-side pwms will have positive or negative polarity. see section 9. pulse-width modulator for motor control (pwmmc) . 1 = negative polarity 0 = positive polarity address: $001f bit 7654321bit 0 read: edge bot- neg top- neg indep lvirst lvip- wr stope copd write: reset states: config00001100 figure 5-1. config register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
configuration register (config) config bits mc68hc908mr8 ? rev 4.0 technical data motorola configuration register (config) 69 topneg ? top-side pwm polarity bit topneg determines if the top-side pwms will have positive or negative polarity. see section 9. pulse-width modulator for motor control (pwmmc) . 1 = negative polarity 0 = positive polarity indep ? independent mode enable bit indep determines if the motor control pwms will be six independent pwms or three complementary pwm pairs. see section 9. pulse-width modulator for motor control (pwmmc) . 1 = six independent pwms 0 = three complementary pwm pairs lvipwr ? lvi power enable bit lvipwr enables the lvi module. see section 17. low-voltage inhibit (lvi) . 1 = lvi module power enabled 0 = lvi module power disabled lvirst ? lvi reset enable bit lvirst enables the reset signal from the lvi module. see section 17. low-voltage inhibit (lvi) . 1 = lvi module resets enabled 0 = lvi module resets disabled stope ? stop enable bit stope enables the stop instruction. see section 6. central processor unit (cpu) . 1 = stop instruction is enabled. 0 = stop instruction is disabled and executes as an illegal instruction. copd ? cop disable bit copd disables the cop module. see section 15. computer operating properly (cop) . 1 = cop module disabled 0 = cop module enabled f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 70 configuration register (config) motorola configuration register (config) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 71 technical data ? mc68hc908mr8 section 6. central processor unit (cpu) 6.1 contents 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 6.4.4 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.7 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.8 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 6.2 introduction this section describes the central processor unit (cpu08, version a). the m68hc08 cpu is an enhanced and fully object-code-compatible version of the m68hc05 cpu. the cpu08 reference manual , motorola document number cpu08rm/ad, contains a description of the cpu instruction set, addressing modes, and architecture. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 72 central processor unit (cpu) motorola central processor unit (cpu) 6.3 features features of the cpu include:  fully upward, object-code compatibility with m68hc05 family  16-bit stack pointer with stack manipulation instructions  16-bit index register with x-register manipulation instructions  8-mhz cpu internal bus frequency  64-kbyte program/data memory space  sixteen addressing modes  memory-to-memory data moves without using the accumulator  fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions  enhanced binary-coded decimal (bcd) data handling  modular architecture with expandable internal bus definition for extension of addressing range beyond 64 kbytes  low-power stop and wait modes 6.4 cpu registers figure 6-1 shows the five cpu registers. cpu registers are not part of the memory map. figure 6-1. cpu registers accumulator (a) index register (h:x) stack pointer (sp) program counter (pc) condition code register (ccr) carry/borrow flag zero flag negative flag interrupt mask half-carry flag two ? s complement overflow flag v11hi nzc h x 0 0 0 0 7 15 15 15 70 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) cpu registers mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 73 6.4.1 accumulator the accumulator is a general-purpose 8-bit register. the cpu uses the accumulator to hold operands and the results of arithmetic/logic operations. 6.4.2 index register the 16-bit index register allows indexed addressing of a 64-kbyte memory space. h is the upper byte of the index register, and x is the lower byte. h:x is the concatenated 16-bit index register. in the indexed addressing modes, the cpu uses the contents of the index register to determine the conditional address of the operand. the index register can serve also as a temporary data storage location. bit 7654321bit 0 read: write: re- set: unaffected by reset figure 6-2. accumulator (a) bit 151413121110987654321 bit 0 read: write: re- set: 00000000 xxxxxxxx x = indeterminate figure 6-3. index register (h:x) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 74 central processor unit (cpu) motorola central processor unit (cpu) 6.4.3 stack pointer the stack pointer (sp) is a 16-bit register that contains the address of the next location on the stack. during a reset, the stack pointer is preset to $00ff. the reset stack pointer (rsp) instruction sets the least significant byte to $ff and does not affect the most significant byte. the stack pointer decrements as data is pushed onto the stack and increments as data is pulled from the stack. in the stack pointer 8-bit offset and 16-bit offset addressing modes, the stack pointer can function as an index register to access data on the stack. the cpu uses the contents of the stack pointer to determine the conditional address of the operand. note: the location of the stack is arbitrary and may be relocated anywhere in ram. moving the sp out of page zero ($0000 to $00ff) frees direct address (page zero) space. for correct operation, the stack pointer must point only to ram locations. bit 151413121110987654321 bit 0 read: write: re- set: 0000000011111111 figure 6-4. stack pointer (sp) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) cpu registers mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 75 6.4.4 program counter the program counter (pc) is a 16-bit register that contains the address of the next instruction or operand to be fetched. normally, the program counter automatically increments to the next sequential memory location every time an instruction or operand is fetched. jump, branch, and interrupt operations load the program counter with an address other than that of the next sequential location. during reset, the program counter is loaded with the reset vector address located at $fffe and $ffff. the vector address is the address of the first instruction to be executed after exiting the reset state. bit 151413121110987654321 bit 0 read: write: re- set: loaded with vector from $fffe and $ffff figure 6-5. program counter (pc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 76 central processor unit (cpu) motorola central processor unit (cpu) 6.4.5 condition code register the 8-bit condition code register (ccr) contains the interrupt mask and five flags that indicate the results of the instruction just executed. bit 6 and bit 5 are set permanently to logic 1. the functions of the condition code register are described here. v ? overflow flag the cpu sets the overflow flag when a two's complement overflow occurs. the signed branch instructions bgt, bge, ble, and blt use the overflow flag. 1 = overflow 0 = no overflow h ? half-carry flag the cpu sets the half-carry flag when a carry occurs between accumulator bits 3 and 4 during an add without carry (add) or add with carry (adc) operation. the half-carry flag is required for binary-coded decimal (bcd) arithmetic operations. the daa instruction uses the states of the h and c flags to determine the appropriate correction factor. 1 = carry between bits 3 and 4 0 = no carry between bits 3 and 4 i ? interrupt mask when the interrupt mask is set, all maskable cpu interrupts are disabled. cpu interrupts are enabled when the interrupt mask is cleared. when a cpu interrupt occurs, the interrupt mask is set automatically after the cpu registers are saved on the stack, but before the interrupt vector is fetched. bit 7654321bit 0 read : v11h i nzc write: re- set: x11x1xxx x = indeterminate figure 6-6. condition code register (ccr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) cpu registers mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 77 1 = interrupts disabled 0 = interrupts enabled note: to maintain m6805 compatibility, the upper byte of the index register (h) is not stacked automatically. if the interrupt service routine modifies h, then the user must stack and unstack h using the pshh and pulh instructions. after the i bit is cleared, the highest-priority interrupt request is serviced first. a return-from-interrupt (rti) instruction pulls the cpu registers from the stack and restores the interrupt mask from the stack. after any reset, the interrupt mask is set and can be cleared only by the clear interrupt mask software instruction (cli). n ? negative flag the cpu sets the negative flag when an arithmetic operation, logic operation, or data manipulation produces a negative result, setting bit 7 of the result. 1 = negative result 0 = non-negative result z ? zero flag the cpu sets the zero flag when an arithmetic operation, logic operation, or data manipulation produces a result of $00. 1 = zero result 0 = non-zero result c ? carry/borrow flag the cpu sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. some instructions ? such as bit test and branch, shift, and rotate ? also clear or set the carry/borrow flag. 1 = carry out of bit 7 0 = no carry out of bit 7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 78 central processor unit (cpu) motorola central processor unit (cpu) 6.5 arithmetic/logic unit (alu) the alu performs the arithmetic and logic operations defined by the instruction set. refer to the cpu08 reference manual, motorola document number cpu08rm/ad, for a description of the instructions and addressing modes and more detail about cpu architecture. 6.6 low-power modes the wait and stop instructions put the mcu in low power-consumption standby modes. 6.6.1 wait mode the wait instruction:  clears the interrupt mask (i bit) in the condition code register, enabling interrupts. after exit from wait mode by interrupt, the i bit remains clear. after exit by reset, the i bit is set.  disables the cpu clock 6.6.2 stop mode the stop instruction:  clears the interrupt mask (i bit) in the condition code register, enabling external interrupts. after exit from stop mode by external interrupt, the i bit remains clear. after exit by reset, the i bit is set.  disables the cpu clock after exiting stop mode, the cpu clock begins running after the oscillator stabilization delay. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) instruction set summary mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 79 6.7 instruction set summary table 6-1 provides a summary of the m68hc08 instruction set. table 6-1. instruction set summary (sheet 1 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc adc # opr adc opr adc opr adc opr ,x adc opr ,x adc ,x adc opr ,sp adc opr ,sp add with carry a (a) + (m) + (c) ?? ? ??? imm dir ext ix2 ix1 ix sp1 sp2 a9 b9 c9 d9 e9 f9 9ee9 9ed9 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 add # opr add opr add opr add opr ,x add opr ,x add ,x add opr ,sp add opr ,sp add without carry a (a) + (m) ?? ? ??? imm dir ext ix2 ix1 ix sp1 sp2 ab bb cb db eb fb 9eeb 9edb ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ais # opr add immediate value (signed) to sp sp (sp) + (16 ? m) ?????? imm a7 ii 2 aix # opr add immediate value (signed) to h:x h:x (h:x) + (16 ? m) ?????? imm af ii 2 and # opr and opr and opr and opr ,x and opr ,x and ,x and opr ,sp and opr ,sp logical and a (a) & (m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 a4 b4 c4 d4 e4 f4 9ee4 9ed4 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 asl opr asla aslx asl opr ,x asl ,x asl opr ,sp arithmetic shift left (same as lsl) ? ?? ??? dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 asr opr asra asrx asr opr ,x asr opr ,x asr opr ,sp arithmetic shift right ? ?? ??? dir inh inh ix1 ix sp1 37 47 57 67 77 9e67 dd ff ff 4 1 1 4 3 5 bcc rel branch if carry bit clear pc (pc) + 2 + rel ? (c) = 0 ?????? rel 24 rr 3 c b0 b7 0 b0 b7 c f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 80 central processor unit (cpu) motorola central processor unit (cpu) bclr n , opr clear bit n in m mn 0 ?????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 11 13 15 17 19 1b 1d 1f dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bcs rel branch if carry bit set (same as blo) pc (pc) + 2 + rel ? (c) = 1 ?????? rel 25 rr 3 beq rel branch if equal pc (pc) + 2 + rel ? (z) = 1 ?????? rel 27 rr 3 bge opr branch if greater than or equal to (signed operands) pc (pc) + 2 + rel ? (n y v) = 0 ?????? rel 90 rr 3 bgt opr branch if greater than (signed operands) pc (pc) + 2 + rel ? (z) | (n y v) = 0 ?????? rel 92 rr 3 bhcc rel branch if half carry bit clear pc (pc) + 2 + rel ? (h) = 0 ?????? rel 28 rr 3 bhcs rel branch if half carry bit set pc (pc) + 2 + rel ? (h) = 1 ?????? rel 29 rr 3 bhi rel branch if higher pc (pc) + 2 + rel ? (c) | (z) = 0 ?????? rel 22 rr 3 bhs rel branch if higher or same (same as bcc) pc (pc) + 2 + rel ? (c) = 0 ?????? rel 24 rr 3 bih rel branch if irq pin high pc (pc) + 2 + rel ? irq = 1 ?????? rel 2f rr 3 bil rel branch if irq pin low pc (pc) + 2 + rel ? irq = 0 ?????? rel 2e rr 3 bit # opr bit opr bit opr bit opr ,x bit opr ,x bit ,x bit opr ,sp bit opr ,sp bit test (a) & (m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 a5 b5 c5 d5 e5 f5 9ee5 9ed5 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ble opr branch if less than or equal to (signed operands) pc (pc) + 2 + rel ? (z) | (n y v) = 1 ?????? rel 93 rr 3 blo rel branch if lower (same as bcs) pc (pc) + 2 + rel ? (c) = 1 ?????? rel 25 rr 3 bls rel branch if lower or same pc (pc) + 2 + rel ? (c) | (z) = 1 ?????? rel 23 rr 3 blt opr branch if less than (signed operands) pc (pc) + 2 + rel ? (n y v) =1 ?????? rel 91 rr 3 bmc rel branch if interrupt mask clear pc (pc) + 2 + rel ? (i) = 0 ?????? rel 2c rr 3 bmi rel branch if minus pc (pc) + 2 + rel ? (n) = 1 ?????? rel 2b rr 3 bms rel branch if interrupt mask set pc (pc) + 2 + rel ? (i) = 1 ?????? rel 2d rr 3 table 6-1. instruction set summary (sheet 2 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) instruction set summary mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 81 bne rel branch if not equal pc (pc) + 2 + rel ? (z) = 0 ?????? rel 26 rr 3 bpl rel branch if plus pc (pc) + 2 + rel ? (n) = 0 ?????? rel 2a rr 3 bra rel branch always pc (pc) + 2 + rel ?????? rel 20 rr 3 brclr n , opr , rel branch if bit n in m clear pc (pc) + 3 + rel ? (mn) = 0 ????? ? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 01 03 05 07 09 0b 0d 0f dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 brn rel branch never pc (pc) + 2 ?????? rel 21 rr 3 brset n , opr , rel branch if bit n in m set pc (pc) + 3 + rel ? (mn) = 1 ????? ? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 00 02 04 06 08 0a 0c 0e dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 bset n , opr set bit n in m mn 1 ?????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 10 12 14 16 18 1a 1c 1e dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bsr rel branch to subroutine pc (pc) + 2; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1 pc (pc) + rel ?????? rel ad rr 4 cbeq opr,rel cbeqa # opr,rel cbeqx # opr,rel cbeq opr, x+ ,rel cbeq x+ ,rel cbeq opr, sp ,rel compare and branch if equal pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 3 + rel ? (x) ? (m) = $00 pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 2 + rel ? (a) ? (m) = $00 pc (pc) + 4 + rel ? (a) ? (m) = $00 ?????? dir imm imm ix1+ ix+ sp1 31 41 51 61 71 9e61 dd rr ii rr ii rr ff rr rr ff rr 5 4 4 5 4 6 clc clear carry bit c 0 ????? 0inh 98 1 cli clear interrupt mask i 0 ?? 0 ??? inh 9a 2 clr opr clra clrx clrh clr opr ,x clr ,x clr opr ,sp clear m $00 a $00 x $00 h $00 m $00 m $00 m $00 0 ?? 01 ? dir inh inh inh ix1 ix sp1 3f 4f 5f 8c 6f 7f 9e6f dd ff ff 3 1 1 1 3 2 4 table 6-1. instruction set summary (sheet 3 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 82 central processor unit (cpu) motorola central processor unit (cpu) cmp # opr cmp opr cmp opr cmp opr ,x cmp opr ,x cmp ,x cmp opr ,sp cmp opr ,sp compare a with m (a) ? (m) ? ?? ??? imm dir ext ix2 ix1 ix sp1 sp2 a1 b1 c1 d1 e1 f1 9ee1 9ed1 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 com opr coma comx com opr ,x com ,x com opr ,sp complement (one ? s complement) m (m ) = $ff ? (m) a (a ) = $ff ? (m) x (x ) = $ff ? (m) m (m ) = $ff ? (m) m (m ) = $ff ? (m) m (m ) = $ff ? (m) 0 ?? ?? 1 dir inh inh ix1 ix sp1 33 43 53 63 73 9e63 dd ff ff 4 1 1 4 3 5 cphx # opr cphx opr compare h:x with m (h:x) ? (m:m + 1) ? ?? ??? imm dir 65 75 ii ii+1 dd 3 4 cpx # opr cpx opr cpx opr cpx ,x cpx opr ,x cpx opr ,x cpx opr ,sp cpx opr ,sp compare x with m (x) ? (m) ? ?? ??? imm dir ext ix2 ix1 ix sp1 sp2 a3 b3 c3 d3 e3 f3 9ee3 9ed3 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 daa decimal adjust a (a) 10 u ?? ??? inh 72 2 dbnz opr,rel dbnza rel dbnzx rel dbnz opr, x ,rel dbnz x ,rel dbnz opr, sp ,rel decrement and branch if not zero a (a) ? 1 or m (m) ? 1 or x (x) ? 1 pc (pc) + 3 + rel ? (result) ? 0 pc (pc) + 2 + rel ? (result) ? 0 pc (pc) + 2 + rel ? (result) ? 0 pc (pc) + 3 + rel ? (result) ? 0 pc (pc) + 2 + rel ? (result) ? 0 pc (pc) + 4 + rel ? (result) ? 0 ?????? dir inh inh ix1 ix sp1 3b 4b 5b 6b 7b 9e6b dd rr rr rr ff rr rr ff rr 5 3 3 5 4 6 dec opr deca decx dec opr ,x dec ,x dec opr ,sp decrement m m) ? 1 a a) ? 1 x (x) ? 1 m (m) ? 1 m (m) ? 1 m (m) ? 1 ? ?? ?? ? dir inh inh ix1 ix sp1 3a 4a 5a 6a 7a 9e6a dd ff ff 4 1 1 4 3 5 div divide a (h:a)/(x) h remainder ???? ?? inh 52 7 eor # opr eor opr eor opr eor opr ,x eor opr ,x eor ,x eor opr ,sp eor opr ,sp exclusive or m with a a (a y m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 a8 b8 c8 d8 e8 f8 9ee8 9ed8 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 table 6-1. instruction set summary (sheet 4 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) instruction set summary mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 83 inc opr inca incx inc opr ,x inc ,x inc opr ,sp increment m m) + 1 a (a) + 1 x x) + 1 m (m) + 1 m (m) + 1 m (m) + 1 ? ?? ?? ? dir inh inh ix1 ix sp1 3c 4c 5c 6c 7c 9e6c dd ff ff 4 1 1 4 3 5 jmp opr jmp opr jmp opr ,x jmp opr ,x jmp ,x jump pc jump address ?????? dir ext ix2 ix1 ix bc cc dc ec fc dd hh ll ee ff ff 2 3 4 3 2 jsr opr jsr opr jsr opr ,x jsr opr ,x jsr ,x jump to subroutine pc (pc) + n ( n = 1, 2, or 3) push (pcl); sp (sp) ? 1 push (pch); sp (sp) ? 1 pc unconditional address ?????? dir ext ix2 ix1 ix bd cd dd ed fd dd hh ll ee ff ff 4 5 6 5 4 lda # opr lda opr lda opr lda opr ,x lda opr ,x lda ,x lda opr ,sp lda opr ,sp load a from m a (m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 a6 b6 c6 d6 e6 f6 9ee6 9ed6 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ldhx # opr ldhx opr load h:x from m h:x (m:m + 1) 0 ?? ?? ? imm dir 45 55 ii jj dd 3 4 ldx # opr ldx opr ldx opr ldx opr ,x ldx opr ,x ldx ,x ldx opr ,sp ldx opr ,sp load x from m x (m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 ae be ce de ee fe 9eee 9ede ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 lsl opr lsla lslx lsl opr ,x lsl ,x lsl opr ,sp logical shift left (same as asl) ? ?? ??? dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 lsr opr lsra lsr x lsr opr ,x lsr ,x lsr opr ,sp logical shift right ? ?? 0 ?? dir inh inh ix1 ix sp1 34 44 54 64 74 9e64 dd ff ff 4 1 1 4 3 5 mov opr,opr mov opr, x+ mov # opr,opr mov x+ ,opr move (m) destination (m) source h:x (h:x) + 1 (ix+d, dix+) 0 ?? ?? ? dd dix+ imd ix+d 4e 5e 6e 7e dd dd dd ii dd dd 5 4 4 4 mul unsigned multiply x:a (x) (a) ? 0 ??? 0inh 42 5 table 6-1. instruction set summary (sheet 5 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc c b0 b7 0 b0 b7 c 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 84 central processor unit (cpu) motorola central processor unit (cpu) neg opr nega negx neg opr ,x neg ,x neg opr ,sp negate (two ? s complement) m ? (m) = $00 ? (m) a ? (a) = $00 ? (a) x ? (x) = $00 ? (x) m ? (m) = $00 ? (m) m ? (m) = $00 ? (m) ? ?? ??? dir inh inh ix1 ix sp1 30 40 50 60 70 9e60 dd ff ff 4 1 1 4 3 5 nop no operation none ?????? inh 9d 1 nsa nibble swap a a (a[3:0]:a[7:4]) ?????? inh 62 3 ora # opr ora opr ora opr ora opr ,x ora opr ,x ora ,x ora opr ,sp ora opr ,sp inclusive or a and m a (a) | (m) 0 ?? ?? ? imm dir ext ix2 ix1 ix sp1 sp2 aa ba ca da ea fa 9eea 9eda ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 psha push a onto stack push (a); sp (sp) ? 1 ?????? inh 87 2 pshh push h onto stack push (h); sp (sp) ? 1 ?????? inh 8b 2 pshx push x onto stack push (x); sp (sp) ? 1 ?????? inh 89 2 pula pull a from stack sp (sp + 1); pull (a) ?????? inh 86 2 pulh pull h from stack sp (sp + 1); pull (h) ?????? inh 8a 2 pulx pull x from stack sp (sp + 1); pull (x) ?????? inh 88 2 rol opr rola rolx rol opr ,x rol ,x rol opr ,sp rotate left through carry ? ?? ??? dir inh inh ix1 ix sp1 39 49 59 69 79 9e69 dd ff ff 4 1 1 4 3 5 ror opr rora rorx ror opr ,x ror ,x ror opr ,sp rotate right through carry ? ?? ??? dir inh inh ix1 ix sp1 36 46 56 66 76 9e66 dd ff ff 4 1 1 4 3 5 rsp reset stack pointer sp $ff ?????? inh 9c 1 rti return from interrupt sp sp) + 1; pull (ccr) sp (sp) + 1; pull (a) sp (sp) + 1; pull (x) sp (sp) + 1; pull (pch) sp (sp) + 1; pull (pcl) ?????? inh 80 7 rts return from subroutine sp sp + 1; pull (pch) sp sp + 1; pull (pcl) ?????? inh 81 4 table 6-1. instruction set summary (sheet 6 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc c b0 b7 b0 b7 c f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processor unit (cpu) instruction set summary mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 85 sbc # opr sbc opr sbc opr sbc opr ,x sbc opr ,x sbc ,x sbc opr ,sp sbc opr ,sp subtract with carry a (a) ? (m) ? (c) ? ?? ??? imm dir ext ix2 ix1 ix sp1 sp2 a2 b2 c2 d2 e2 f2 9ee2 9ed2 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 sec set carry bit c 1 ????? 1inh 99 1 sei set interrupt mask i 1 ?? 1 ??? inh 9b 2 sta opr sta opr sta opr ,x sta opr ,x sta ,x sta opr ,sp sta opr ,sp store a in m m (a) 0 ?? ?? ? dir ext ix2 ix1 ix sp1 sp2 b7 c7 d7 e7 f7 9ee7 9ed7 dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sthx opr store h:x in m (m:m + 1) (h:x) 0 ?? ?? ? dir 35 dd 4 stop enable irq pin; stop oscillator i 0; stop oscillator ?? 0 ??? inh 8e 1 stx opr stx opr stx opr ,x stx opr ,x stx ,x stx opr ,sp stx opr ,sp store x in m m (x) 0 ?? ?? ? dir ext ix2 ix1 ix sp1 sp2 bf cf df ef ff 9eef 9edf dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sub # opr sub opr sub opr sub opr ,x sub opr ,x sub ,x sub opr ,sp sub opr ,sp subtract a (a) ? (m) ? ?? ??? imm dir ext ix2 ix1 ix sp1 sp2 a0 b0 c0 d0 e0 f0 9ee0 9ed0 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 swi software interrupt pc (pc) + 1; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1; push (x) sp (sp) ? 1; push (a) sp (sp) ? 1; push (ccr) sp (sp) ? 1; i 1 pch interrupt vector high byte pcl interrupt vector low byte ?? 1 ??? inh 83 9 tap transfer a to ccr ccr (a) ?????? inh 84 2 tax transfer a to x x (a) ?????? inh 97 1 tpa transfer ccr to a a (ccr) ?????? inh 85 1 table 6-1. instruction set summary (sheet 7 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 86 central processor unit (cpu) motorola central processor unit (cpu) 6.8 opcode map see table 6-2 . tst opr tsta tstx tst opr ,x tst ,x tst opr ,sp test for negative or zero (a) ? $00 or (x) ? $00 or (m) ? $00 0 ?? ?? ? dir inh inh ix1 ix sp1 3d 4d 5d 6d 7d 9e6d dd ff ff 3 1 1 3 2 4 tsx transfer sp to h:x h:x (sp) + 1 ?????? inh 95 2 txa transfer x to a a (x) ?????? inh 9f 1 txs transfer h:x to sp (sp) (h:x) ? 1 ?????? inh 94 2 wait enable interrupts; stop processor i bit 0 ?? 0 ??? inh 8f 1 a accumulator n any bit c carry/borrow bit opr operand (one or two bytes) ccr condition code register pc program counter dd direct address of operand pch program counter high byte dd rr direct address of operand and relative offset of branch instruction pcl program counter low byte dd direct to direct addressing mode rel relative addressing mode dir direct addressing mode rel relative program counter offset byte dix+ direct to indexed with post increment addressing mode rr relative program counter offset byte ee ff high and low bytes of offset in indexed, 16-bit offset addressing sp1 stack pointer, 8-bit offset addressing mode ext extended addressing mode sp2 stack pointer 16-bit offset addressing mode ff offset byte in indexed, 8-bit offset addressing sp stack pointer h half-carry bit u undefined h index register high byte v overflow bit hh ll high and low bytes of operand address in extended addressing x index register low byte i interrupt mask z zero bit ii immediate operand byte & logical and imd immediate source to direct destination addressing mode | logical or imm immediate addressing mode ? ( ) negation (two ? s complement) ix+ indexed, no offset, post increment addressing mode # immediate value ix+d indexed with post increment to direct addressing mode ? sign extend ix1 indexed, 8-bit offset addressing mode ? ? not affected table 6-1. instruction set summary (sheet 8 of 8) source form operation description effect on ccr address mode opcode operand cycles vh i nzc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola central processor unit (cpu) 87 central processor unit (cpu) opcode map table 6-2. opcode map bit manipulation branch read-modify-write control register/memory dir dir rel dir inh inh ix1 sp1 ix inh inh imm dir ext ix2 sp2 ix1 sp1 ix 0 12 3 4 5 69e67 8 9abcd9ede9eef 0 5 brset0 3dir 4 bset0 2dir 3 bra 2rel 4 neg 2dir 1 nega 1inh 1 negx 1inh 4 neg 2ix1 5 neg 3 sp1 3 neg 1ix 7 rti 1inh 3 bge 2rel 2 sub 2imm 3 sub 2dir 4 sub 3 ext 4 sub 3ix2 5 sub 4 sp2 3 sub 2ix1 4 sub 3sp1 2 sub 1ix 1 5 brclr0 3dir 4 bclr0 2dir 3 brn 2rel 5 cbeq 3dir 4 cbeqa 3imm 4 cbeqx 3imm 5 cbeq 3ix1+ 6 cbeq 4 sp1 4 cbeq 2ix+ 4 rts 1inh 3 blt 2rel 2 cmp 2imm 3 cmp 2dir 4 cmp 3 ext 4 cmp 3ix2 5 cmp 4 sp2 3 cmp 2ix1 4 cmp 3sp1 2 cmp 1ix 2 5 brset1 3dir 4 bset1 2dir 3 bhi 2rel 5 mul 1inh 7 div 1inh 3 nsa 1inh 2 daa 1inh 3 bgt 2rel 2 sbc 2imm 3 sbc 2dir 4 sbc 3 ext 4 sbc 3ix2 5 sbc 4 sp2 3 sbc 2ix1 4 sbc 3sp1 2 sbc 1ix 3 5 brclr1 3dir 4 bclr1 2dir 3 bls 2rel 4 com 2dir 1 coma 1inh 1 comx 1inh 4 com 2ix1 5 com 3 sp1 3 com 1ix 9 swi 1inh 3 ble 2rel 2 cpx 2imm 3 cpx 2dir 4 cpx 3 ext 4 cpx 3ix2 5 cpx 4 sp2 3 cpx 2ix1 4 cpx 3sp1 2 cpx 1ix 4 5 brset2 3dir 4 bset2 2dir 3 bcc 2rel 4 lsr 2dir 1 lsra 1inh 1 lsrx 1inh 4 lsr 2ix1 5 lsr 3 sp1 3 lsr 1ix 2 tap 1inh 2 txs 1inh 2 and 2imm 3 and 2dir 4 and 3 ext 4 and 3ix2 5 and 4 sp2 3 and 2ix1 4 and 3sp1 2 and 1ix 5 5 brclr2 3dir 4 bclr2 2dir 3 bcs 2rel 4 sthx 2dir 3 ldhx 3imm 4 ldhx 2dir 3 cphx 3imm 4 cphx 2dir 1 tpa 1inh 2 tsx 1inh 2 bit 2imm 3 bit 2dir 4 bit 3 ext 4 bit 3ix2 5 bit 4 sp2 3 bit 2ix1 4 bit 3sp1 2 bit 1ix 6 5 brset3 3dir 4 bset3 2dir 3 bne 2rel 4 ror 2dir 1 rora 1inh 1 rorx 1inh 4 ror 2ix1 5 ror 3 sp1 3 ror 1ix 2 pula 1inh 2 lda 2imm 3 lda 2dir 4 lda 3 ext 4 lda 3ix2 5 lda 4 sp2 3 lda 2ix1 4 lda 3sp1 2 lda 1ix 7 5 brclr3 3dir 4 bclr3 2dir 3 beq 2rel 4 asr 2dir 1 asra 1inh 1 asrx 1inh 4 asr 2ix1 5 asr 3 sp1 3 asr 1ix 2 psha 1inh 1 tax 1inh 2 ais 2imm 3 sta 2dir 4 sta 3 ext 4 sta 3ix2 5 sta 4 sp2 3 sta 2ix1 4 sta 3sp1 2 sta 1ix 8 5 brset4 3dir 4 bset4 2dir 3 bhcc 2rel 4 lsl 2dir 1 lsla 1inh 1 lslx 1inh 4 lsl 2ix1 5 lsl 3 sp1 3 lsl 1ix 2 pulx 1inh 1 clc 1inh 2 eor 2imm 3 eor 2dir 4 eor 3 ext 4 eor 3ix2 5 eor 4 sp2 3 eor 2ix1 4 eor 3sp1 2 eor 1ix 9 5 brclr4 3dir 4 bclr4 2dir 3 bhcs 2rel 4 rol 2dir 1 rola 1inh 1 rolx 1inh 4 rol 2ix1 5 rol 3 sp1 3 rol 1ix 2 pshx 1inh 1 sec 1inh 2 adc 2imm 3 adc 2dir 4 adc 3 ext 4 adc 3ix2 5 adc 4 sp2 3 adc 2ix1 4 adc 3sp1 2 adc 1ix a 5 brset5 3dir 4 bset5 2dir 3 bpl 2rel 4 dec 2dir 1 deca 1inh 1 decx 1inh 4 dec 2ix1 5 dec 3 sp1 3 dec 1ix 2 pulh 1inh 2 cli 1inh 2 ora 2imm 3 ora 2dir 4 ora 3 ext 4 ora 3ix2 5 ora 4 sp2 3 ora 2ix1 4 ora 3sp1 2 ora 1ix b 5 brclr5 3dir 4 bclr5 2dir 3 bmi 2rel 5 dbnz 3dir 3 dbnza 2inh 3 dbnzx 2inh 5 dbnz 3ix1 6 dbnz 4 sp1 4 dbnz 2ix 2 pshh 1inh 2 sei 1inh 2 add 2imm 3 add 2dir 4 add 3 ext 4 add 3ix2 5 add 4 sp2 3 add 2ix1 4 add 3sp1 2 add 1ix c 5 brset6 3dir 4 bset6 2dir 3 bmc 2rel 4 inc 2dir 1 inca 1inh 1 incx 1inh 4 inc 2ix1 5 inc 3 sp1 3 inc 1ix 1 clrh 1inh 1 rsp 1inh 2 jmp 2dir 3 jmp 3 ext 4 jmp 3ix2 3 jmp 2ix1 2 jmp 1ix d 5 brclr6 3dir 4 bclr6 2dir 3 bms 2rel 3 tst 2dir 1 tsta 1inh 1 tstx 1inh 3 tst 2ix1 4 tst 3 sp1 2 tst 1ix 1 nop 1inh 4 bsr 2rel 4 jsr 2dir 5 jsr 3 ext 6 jsr 3ix2 5 jsr 2ix1 4 jsr 1ix e 5 brset7 3dir 4 bset7 2dir 3 bil 2rel 5 mov 3dd 4 mov 2dix+ 4 mov 3imd 4 mov 2ix+d 1 stop 1inh * 2 ldx 2imm 3 ldx 2dir 4 ldx 3 ext 4 ldx 3ix2 5 ldx 4 sp2 3 ldx 2ix1 4 ldx 3sp1 2 ldx 1ix f 5 brclr7 3dir 4 bclr7 2dir 3 bih 2rel 3 clr 2dir 1 clra 1inh 1 clrx 1inh 3 clr 2ix1 4 clr 3 sp1 2 clr 1ix 1 wait 1inh 1 txa 1inh 2 aix 2imm 3 stx 2dir 4 stx 3 ext 4 stx 3ix2 5 stx 4 sp2 3 stx 2ix1 4 stx 3sp1 2 stx 1ix inh inherent rel relative sp1 stack pointer, 8-bit offset imm immediate ix indexed, no offset sp2 stack pointer, 16-bit offset dir direct ix1 indexed, 8-bit offset ix+ indexed, no offset with ext extended ix2 indexed, 16-bit offset post increment dd direct-direct imd immediate-direct ix1+ indexed, 1-byte offset with ix+d indexed-direct dix+ direct-indexed post increment * pre-byte for stack pointer indexed instructions 0 high byte of opcode in hexadecimal low byte of opcode in hexadecimal 0 5 brset0 3dir cycles opcode mnemonic number of bytes / addressing mode msb lsb msb lsb f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 88 central processor unit (cpu) motorola central processor unit (cpu) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 89 technical data ? mc68hc908mr8 section 7. system integration module (sim) 7.1 contents 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.3 sim bus clock control and generation . . . . . . . . . . . . . . . . 93 7.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 7.3.2 clock startup from por or lvi reset . . . . . . . . . . . . . . . 93 7.3.3 clocks in wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.4 reset and system initialization . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.1 external pin reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.2 active resets from internal sources . . . . . . . . . . . . . . . . 95 7.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 7.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . . 99 7.5.2 sim counter and reset states . . . . . . . . . . . . . . . . . . . . . 99 7.6 exception control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 7.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 7.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.6.3 status flag protection in break mode . . . . . . . . . . . . . . 103 7.7 low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 7.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 7.7.3 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . 106 7.7.4 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . . 108 7.7.5 sim break flag control register . . . . . . . . . . . . . . . . . . 109 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 90 system integration module (sim) motorola system integration module (sim) 7.2 introduction this section describes the system integration module (sim). together with the central processor unit (cpu), the sim controls all microcontroller unit (mcu) activities. a block diagram of the sim is shown in figure 7-1 . figure 7-2 is a summary of the sim inout/output (i/o) registers. the sim is a system state controller that coordinates cpu and exception timing. the sim is responsible for:  bus clock generation and control for cpu and peripherals: ? stop, wait, reset, break entry, and recovery ? internal clock control  master reset control, including power-on reset (por) and computer operating properly (cop) timeout  interrupt control: ? acknowledge timing ? arbitration control timing ? vector address generation  cpu enable/disable timing  modular architecture expandable to 128 interrupt sources f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) introduction mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 91 figure 7-1. sim block diagram stop/wait clock control clock generators por control reset pin control sim reset status register interrupt control and priority decode module wait cpu wait (from cpu) simoscen (to cgm) cgmout (from cgm) internal clocks master reset control reset pin logic lvi (from lvi module) illegal opcode (from cpu) illegal address (from address map decoders) cop (from cop module) interrupt sources cpu interface reset control sim counter cop clock cgmxclk (from cgm) 2 module stop cpu stop (from cpu) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 92 system integration module (sim) motorola system integration module (sim) table 7-1 shows the internal signal names used in this section. addr. register name bit 7654321bit 0 $fe00 sim break status register (sbsr) see page 106. read: rrrrrr sbsw r write: note 1 re- set: 0 $fe01 sim reset status register (srsr) see page 108. read: por pin cop ilop ilad 0 lvi 0 write:rrrrrrrr re- set: 10000000 $fe03 sim break flag control register (sbfcr) see page 109. read: bcferrrrrrr write: re- set: 0 note 1. writing a logic 0 clears sb- sw. r = reserved figure 7-2. sim i/o register summary table 7-1. signal name conventions signal name description cgmxclk buffered version of osc1 from clock generator module (cgm) cgmvclk pll output cgmout pll-based or osc1-based clock output from cgm module (bus clock = cgmout divided by two) iab internal address bus idb internal data bus porrst signal from the power-on reset module to the sim irst internal reset signal r/w read/write signal f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) sim bus clock control and generation mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 93 7.3 sim bus clock control and generation the bus clock generator provides system clock signals for the cpu and peripherals on the mcu. the system clocks are generated from an incoming clock, cgmout, as shown in figure 7-3 . this clock can come from either an external oscillator or from the on-chip phase-locked loop (pll). see section 8. clock generator module (cgm) . figure 7-3. cgm clock signals 7.3.1 bus timing in user mode , the internal bus frequency is either the crystal oscillator output (cgmxclk) divided by four or the pll output (cgmvclk) divided by four. see section 8. clock generator module (cgm) . 7.3.2 clock startup from por or lvi reset when the power-on reset (por) module or the low-voltage inhibit (lvi) module generates a reset, the clocks to the cpu and peripherals are inactive and held in an inactive phase until after the 4096 cgmxclk cycle por timeout has completed. the rst pin is driven low by the sim during this entire period. the ibus clocks start upon completion of the timeout. pll osc1 cgmxclk 2 bus clock generators sim cgm sim counter monitor mode clock select circuit cgmvclk bcs 2 a b s* cgmout *when s = 1, cgmout = b user mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 94 system integration module (sim) motorola system integration module (sim) 7.3.3 clocks in wait mode in wait mode, the cpu clocks are inactive. the sim also produces two sets of clocks for other modules. refer to the wait mode subsection of each module to see if the module is active or inactive in wait mode. some modules can be programmed to be active in wait mode. 7.4 reset and system initialization the mcu has these reset sources:  power-on reset module (por)  external reset pin (rst )  computer operating properly module (cop)  low-voltage inhibit module (lvi)  illegal opcode  illegal address all of these resets produce the vector $fffe ? ffff ($fefe ? feff in monitor mode) and assert the internal reset signal (irst). irst causes all registers to be returned to their default values and all modules to be returned to their reset states. an internal reset clears the sim counter (see 7.5 sim counter ), but an external reset does not. each of the resets sets a corresponding bit in the sim reset status register (srsr). see 7.7.4 sim reset status register . 7.4.1 external pin reset pulling the asynchronous rst pin low halts all processing. the pin bit of the sim reset status register (srsr) is set as long as rst is held low for a minimum of 67 cgmxclk cycles, assuming that neither the por nor the lvi was the source of the reset. see table 7-2 for details. figure 7-4 shows the relative timing. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) reset and system initialization mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 95 figure 7-4. external reset timing 7.4.2 active resets from internal sources all internal reset sources actively pull the rst pin low for 32 cgmxclk cycles to allow resetting of external peripherals. the internal reset signal (irst) continues to be asserted for an additional 32 cycles (see figure 7-5 ). an internal reset can be caused by an illegal address, illegal opcode, cop timeout, lvi, or por (see figure 7-6 ). note: for lvi or por resets, the sim cycles through 4096 cgmxclk cycles during which the sim forces the rst pin low. the internal reset signal then follows the sequence from the falling edge of rst as shown in figure 7-5 . figure 7-5. internal reset timing table 7-2. pin bit set timing reset type number of cycles required to set pin por/lvi 4163 (4096 + 64 + 3) all others 67 (64 + 3) rst iab pc vect h vect l cgmout irst rst rst pulled low by mcu iab 32 cycles 32 cycles vector high cgmxclk f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 96 system integration module (sim) motorola system integration module (sim) the cop reset is asynchronous to the bus clock. figure 7-6. sources of internal reset the active reset feature allows the part to issue a reset to peripherals and other chips within a system built around the mcu. 7.4.2.1 power-on reset (por) when power is first applied to the mcu, the power-on reset (por) module generates a pulse to indicate that power-on has occurred. the external reset pin (rst ) is held low while the sim counter counts out 4096 cgmxclk cycles. sixty-four cgmxclk cycles later, the cpu and memories are released from reset to allow the reset vector sequence to occur. at power-on, these events occur:  a por pulse is generated.  the internal reset signal is asserted.  the sim enables cgmout.  internal clocks to the cpu and modules are held inactive for 4096 cgmxclk cycles to allow stabilization of the oscillator.  the rst pin is driven low during the oscillator stabilization time.  the por bit of the sim reset status register (srsr) is set and all other bits in the register are cleared. illegal address rst illegal opcode rst coprst lvi por internal reset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) reset and system initialization mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 97 figure 7-7. por recovery 7.4.2.2 computer operating properly (cop) reset an input to the sim is reserved for the cop reset signal. the overflow of the cop counter causes an internal reset and sets the cop bit in the sim reset status register (srsr). the sim actively pulls down the rst pin for all internal reset sources. to prevent a cop module timeout, write any value to location $ffff. writing to location $ffff clears the cop counter and bits 12 ? 4 of the sim counter. the sim counter output, which occurs at least every 2 13 ? 2 4 cgmxclk cycles, drives the cop counter. the cop should be serviced as soon as possible out of reset to guarantee the maximum amount of time before the first timeout. the cop module is disabled if the rst pin or the irq pin is held at v dd +v hi while the mcu is in monitor mode. the cop module can be disabled only through combinational logic conditioned with the high voltage signal on the rst or the irq pin. this prevents the cop from becoming disabled as a result of external noise. during a break state, v dd +v hi on the rst pin disables the cop module. porrst osc1 cgmxclk cgmout rst iab 4096 cycles 32 cycles 32 cycles $fffe $ffff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 98 system integration module (sim) motorola system integration module (sim) 7.4.2.3 illegal opcode reset the sim decodes signals from the cpu to detect illegal instructions. an illegal instruction sets the ilop bit in the sim reset status register (srsr) and causes a reset. because the mc68hc08mr8 has stop mode disabled by bit 1 in the config register, execution of the stop instruction will cause an illegal opcode reset if stop mode has not been enabled by setting config register bit 1. 7.4.2.4 illegal address reset an opcode fetch from addresses other than flash, i/o, or ram addresses generates an illegal address reset (unimplemented locations within memory map). the sim verifies that the cpu is fetching an opcode prior to asserting the ilad bit in the sim reset status register (srsr) and resetting the mcu. a data fetch from an unmapped address does not generate a reset. 7.4.2.5 low-voltage inhibit (lvi) reset the low-voltage inhibit module (lvi) asserts its output to the sim when the v dd voltage falls to the lvi lvrx voltage and remains at or below that level for at least nine consecutive cpu cycles. the lvi bit in the sim reset status register (srsr) is set, and the external reset pin (rst ) is held low while the sim counter counts out 4096 cgmxclk cycles. sixty-four cgmxclk cycles later, the cpu is released from reset to allow the reset vector sequence to occur. the sim actively pulls down the rst pin for all internal reset sources. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) sim counter mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 99 7.5 sim counter the sim counter is used by the por module to allow the oscillator time to stabilize before enabling the internal bus (ibus) clocks. the sim counter also serves as a prescaler for the cop module. the sim counter overflow supplies the clock for the cop module. the sim counter is 13 bits long and is clocked by the falling edge of cgmxclk. 7.5.1 sim counter during power-on reset the por detects power applied to the mcu. at power-on, the por circuit asserts the signal porrst. once the sim is initialized, it enables the clock generation module (cgm) to drive the bus clock state machine. 7.5.2 sim counter and reset states external reset has no effect on the sim counter. the sim counter is free-running after all reset states. see 7.4.2 active resets from internal sources for counter control and internal reset recovery sequences. 7.6 exception control normal, sequential program execution can be changed in three different ways: 1. interrupts: a. maskable hardware cpu interrupts b. non-maskable software interrupt instruction (swi) 2. reset 3. break interrupts f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 100 system integration module (sim) motorola system integration module (sim) 7.6.1 interrupts at the beginning of an interrupt, the cpu saves the cpu register contents on the stack and sets the interrupt mask (i bit) to prevent additional interrupts. at the end of an interrupt, the return from interrupt (rti) instruction recovers the cpu register contents from the stack so that normal processing can resume. figure 7-8 shows interrupt entry timing. figure 7-10 shows interrupt recovery timing. interrupts are latched, and arbitration is performed in the sim at the start of interrupt processing. the arbitration result is a constant that the cpu uses to determine which vector to fetch. once an interrupt is latched by the sim, no other interrupt can take precedence, regardless of priority, until the latched interrupt is serviced (or the i bit is cleared). see figure 7-9 . figure 7-8 . interrupt entry module idb r/w interrupt dummy sp sp ? 1 sp ? 2 sp ? 3 sp ? 4 vect h vect l start addr iab dummy pc ? 1[7:0] pc ? 1[15:8] x a ccr v data h v data l opcode i bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) exception control mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 101 figure 7-9. interrupt processing no no no yes no no yes no yes yes as many interrupts as exist on chip i bit set? from reset break interrupt? i bit set? int0 interrupt? int1 interrupt? swi instruction? rti instruction? fetch next instruction unstack cpu registers stack cpu registers set i bit load pc with interrupt vector execute instruction yes yes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 102 system integration module (sim) motorola system integration module (sim) figure 7-10. interrupt recovery 7.6.1.1 hardware interrupts a hardware interrupt does not stop the current instruction. processing of a hardware interrupt begins after completion of the current instruction. when the current instruction is complete, the sim checks all pending hardware interrupts. if interrupts are not masked (i bit clear in the condition code register), and if the corresponding interrupt enable bit is set, the sim proceeds with interrupt processing; otherwise, the next instruction is fetched and executed. if more than one interrupt is pending at the end of an instruction execution, the highest priority interrupt is serviced first. figure 7-11 demonstrates what happens when two interrupts are pending. if an interrupt is pending upon exit from the original interrupt service routine, the pending interrupt is serviced before the lda instruction is executed. the lda opcode is prefetched by both the int1 and int2 rti instructions. however, in the case of the int1 rti prefetch, this is a redundant operation. note: to maintain compatibility with the m6805 family, the h register is not pushed on the stack during interrupt entry. if the interrupt service routine modifies the h register or uses the indexed addressing mode, software should save the h register and then restore it prior to exiting the routine. module idb r/w interrupt sp ? 4 sp ? 3 sp ? 2 sp ? 1 sp pc pc + 1 iab ccr a x pc ? 1[7:0] pc ? 1[15:8] opcode operand i bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) exception control mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 103 figure 7-11 . interrupt recognition example 7.6.1.2 swi instruction the swi instruction is a non-maskable instruction that causes an interrupt regardless of the state of the interrupt mask (i bit) in the condition code register. note: a software interrupt pushes pc onto the stack. a software interrupt does not push pc ? 1, as a hardware interrupt does. 7.6.2 reset all reset sources always have equal and highest priority and cannot be arbitrated. 7.6.3 status flag protection in break mode the sim controls whether status flags contained in other modules can be cleared during break mode. the user can select whether flags are protected from being cleared by properly initializing the break clear flag enable bit (bcfe) in the sim break flag control register (sbfcr). cli lda int1 pulh rti int2 background routine #$ff pshh int1 interrupt service routine pulh rti pshh int2 interrupt service routine f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 104 system integration module (sim) motorola system integration module (sim) protecting flags in break mode ensures that set flags will not be cleared while in break mode. this protection allows registers to be freely read and written during break mode without losing status flag information. setting the bcfe bit enables the clearing mechanisms. once cleared in break mode, a flag remains cleared even when break mode is exited. status flags with a 2-step clearing mechanism ? for example, a read of one register followed by the read or write of another ? are protected, even when the first step is accomplished prior to entering break mode. upon leaving break mode, execution of the second step will clear the flag as normal. 7.7 low-power mode executing the wait or stop instruction puts the mcu in a low power-consumption mode for standby situations. the sim holds the cpu in a non-clocked state. both stop and wait clear the interrupt mask (i) in the condition code register, allowing interrupts to occur. 7.7.1 wait mode in wait mode, the cpu clocks are inactive while the peripheral clocks continue to run. figure 7-12 shows the timing for wait mode entry. figure 7-12. wait mode entry timing a module that is active during wait mode can wake up the cpu with an interrupt if the interrupt is enabled. stacking for the interrupt begins one cycle after the wait instruction during which the interrupt occurred. refer to the wait mode subsection of each module to see if the module wait addr + 1 same same iab idb previous data next opcode same wait addr same r/w note: previous data can be operand data or the wait opcode, depending on the last instruction. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) low-power mode mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 105 is active or inactive in wait mode. some modules can be programmed to be active in wait mode. wait mode can also be exited by a reset or break. a break interrupt during wait mode sets the sim break stop/wait bit, sbsw, in the sim break status register (sbsr). if the cop disable bit, copd, in the configuration register is logic 0, then the computer operating properly module (cop) is enabled and remains active in wait mode. figure 7-13 and figure 7-14 show the timing for wait recovery. figure 7-13. wait recovery from interrupt or break figure 7-14. wait recovery from internal reset $6e0c $6e0b $00ff $00fe $00fd $00fc $a6 $a6 $01 $0b $6e $a6 iab idb exitstopwait note: exitstopwait = rst pin or cpu interrupt or break interrupt iab idb rst $a6 $a6 $6e0b rst vct h rst vct l $a6 cgmxclk 32 cycles 32 cycles f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 106 system integration module (sim) motorola system integration module (sim) 7.7.2 stop mode in stop mode, the sim counter is reset and the system clock is disabled. an external interrupt request will cause an exit from stop mode. stacking for interrupts begins after the stop recovery delay time of 4096 cgmxclk cycles has elapsed. reset or break also cause an exit from stop mode. the sim disables the clock generator module outputs in stop mode, stopping the cpu and all peripherals. note: it is important to note that when using the pwm generator its outputs will stop toggling when stop mode is entered. the pwm module must be disabled before entering stop mode to prevent external inverter failure. 7.7.3 sim break status register the sim break status register (sbsr) contains a flag to indicate that a break caused an exit from wait mode. sbsw ? sim break stop/wait bit this status bit is useful in applications requiring a return to wait mode after exiting from a break interrupt. clear sbsw by writing a logic 0 to it. reset clears sbsw. 1 = wait mode was exited by break interrupt. 0 = wait mode was not exited by break interrupt. ad- dress: $fe00 bit 7654321bit 0 read: rrrrrr sbsw r write: note (1) reset: 0 r = reserved 1. writing a logic 0 clears sbsw. figure 7-15. sim break status register (sbsr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) low-power mode mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 107 sbsw can be read within the break state swi routine. the user can modify the return address on the stack by subtracting one from it. the following code is an example of this. writing 0 to the sbsw bit clears it. ; ; ; this code works if the h register has been pushed onto the stack in the break service routine software. this code should be executed at the end of the break service routine software. hibyte equ 5 lobyte equ 6 ; if not sbsw, do rti brclr sbsw,sbsr, return ; ; see if wait mode was exited by break. tst lobyte,sp ; if returnlo is not zero, bne dolo ; then just decrement low byte. dec hibyte,sp ; else deal with high byte, too. dolo dec lobyte,sp ; point to wait opcode. return pulh rti ; restore h register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 108 system integration module (sim) motorola system integration module (sim) 7.7.4 sim reset status register the sim reset status register (srsr) contains six flags that show the source of the last reset. clear the srsr by reading it. a power-on reset sets the por bit and clears all other bits in the register. por ? power-on reset bit 1 = last reset caused by por circuit 0 = read of srsr pin ? external reset bit 1 = last reset caused by external reset pin (rst ) 0 = por or read of srsr cop ? computer operating properly reset bit 1 = last reset caused by cop counter 0 = por or read of srsr ilop ? illegal opcode reset bit 1 = last reset caused by an illegal opcode 0 = por or read of srsr ilad ? illegal address reset bit (opcode fetches only) 1 = last reset caused by an opcode fetch from an illegal address 0 = por or read of srsr lvi ? low-voltage inhibit reset bit 1 = last reset was caused by the lvi circuit 0 = por or read of srsr ad- dress: $fe01 bit 7654321bit 0 read: por pin cop ilop ilad 0 lvi 0 write:rrrrrrrr reset:10000000 r= reserved figure 7-16. sim reset status register (srsr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system integration module (sim) low-power mode mc68hc908mr8 ? rev 4.0 technical data motorola system integration module (sim) 109 7.7.5 sim break flag control register the sim break control register (sbfcr) contains a bit that enables software to clear status bits while the mcu is in a break state. bcfe ? break clear flag enable bit this read/write bit enables software to clear status bits by accessing status registers while the mcu is in a break state. to clear status bits during the break state, the bcfe bit must be set. 1 = status bits clearable during break 0 = status bits not clearable during break ad- dress: $fe03 bit 7654321bit 0 read: bcferrrrrrr write: reset: 0 r= reserved figure 7-17. sim break flag control register (sbfcr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 110 system integration module (sim) motorola system integration module (sim) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 111 technical data ? mc68hc908mr8 section 8. clock generator module (cgm) 8.1 contents 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 8.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 8.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 8.4.1 crystal oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . 113 8.4.2 phase-locked loop circuit (pll) . . . . . . . . . . . . . . . . . . 115 8.4.3 base clock selector circuit . . . . . . . . . . . . . . . . . . . . . . 121 8.4.4 cgm external connections . . . . . . . . . . . . . . . . . . . . . . . 122 8.5 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 8.5.1 cgm external connections . . . . . . . . . . . . . . . . . . . . . . . 122 8.5.2 crystal amplifier output pin (osc2) . . . . . . . . . . . . . . . 123 8.5.3 external filter capacitor pin (cgmxfc) . . . . . . . . . . . . 123 8.5.4 pll analog power pin (v dda ) . . . . . . . . . . . . . . . . . . . . . 124 8.5.5 oscillator enable signal (simoscen) . . . . . . . . . . . . . . 124 8.5.6 crystal output frequency signal (cgmxclk) . . . . . . . 124 8.5.7 cgm base clock output (cgmout) . . . . . . . . . . . . . . . 124 8.5.8 cgm cpu interrupt (cgmint) . . . . . . . . . . . . . . . . . . . . . 124 8.6 cgm registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.6.1 pll control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 8.6.2 pll bandwidth control register . . . . . . . . . . . . . . . . . . 129 8.6.3 pll programming register . . . . . . . . . . . . . . . . . . . . . . . 131 8.7 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 8.8 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.9 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.10 cgm during break mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.11 acquisition/lock time specifications . . . . . . . . . . . . . . . . 134 8.11.1 acquisition/lock time definitions . . . . . . . . . . . . . . . . . 134 8.11.2 parametric influences on reaction time . . . . . . . . . . . . 135 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 112 clock generator module (cgm) motorola clock generator module (cgm) 8.11.3 choosing a filter capacitor . . . . . . . . . . . . . . . . . . . . . . 136 8.11.4 reaction time calculation . . . . . . . . . . . . . . . . . . . . . . . 137 8.2 introduction this section describes the clock generator module (cgm, version a). the cgm generates the crystal clock signal, cgmxclk, which operates at the frequency of the crystal. the cgm also generates the base clock signal, cgmout, from which the system integration module (sim) derives the system clocks. cgmout is based on either the crystal clock divided by two or the phase-locked loop (pll) clock, cgmvclk, divided by two. the pll is a frequency generator designed for use with crystals or ceramic resonators. the pll can generate an 8-mhz bus frequency without using a 32-mhz crystal. 8.3 features features of the cgm include:  phase-locked loop with output frequency in integer multiples of the crystal reference  programmable hardware voltage-controlled oscillator (vco) for low-jitter operation  automatic bandwidth control mode for low-jitter operation  automatic frequency lock detector  central processor unit (cpu) interrupt on entry or exit from locked condition f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) functional description mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 113 8.4 functional description the cgm consists of three major submodules: 1. crystal oscillator circuit ? the crystal oscillator circuit generates the constant crystal frequency clock, cgmxclk. 2. phase-locked loop (pll) ? the pll generates the programmable vco frequency clock, cgmvclk. 3. base clock selector circuit ? this software-controlled circuit selects either cgmxclk divided by two or the vco clock, cgmvclk, divided by two as the base clock, cgmout. the sim derives the system clocks from cgmout. figure 8-1 shows the structure of the cgm. 8.4.1 crystal oscillator circuit the crystal oscillator circuit consists of an inverting amplifier and an external crystal. the osc1 pin is the input to the amplifier and the osc2 pin is the output. the simoscen signal from the system integration module (sim) enables the crystal oscillator circuit. the cgmxclk signal is the output of the crystal oscillator circuit and runs at a rate equal to the crystal frequency. cgmxclk is then buffered to produce cgmrclk, the pll reference clock. cgmxclk can be used by other modules which require precise timing for operation. the duty cycle of cgmxclk is not guaranteed to be 50 percent and depends on external factors, including the crystal and related external components. an externally generated clock also can feed the osc1 pin of the crystal oscillator circuit. connect the external clock to the osc1 pin and let the osc2 pin float. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 114 clock generator module (cgm) motorola clock generator module (cgm) figure 8-1. cgm block diagram bcs phase detector loop filter frequency divider voltage controlled oscillator bandwidth control lock detector clock cgmxclk cgmout cgmvdv cgmvclk simoscen crystal oscillator interrupt control cgmint cgmrdv pll analog 2 cgmrclk select circuit lock auto acq vrs[7:4] pllie pllf mul[7:4] cgmxfc v ss v dda osc1 osc2 to sim to sim monitor mode a b s* user mode *when s = 1, cgmout = b f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) functional description mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 115 8.4.2 phase-locked loop circuit (pll) the pll is a frequency generator that can operate in either acquisition mode or tracking mode, depending on the accuracy of the output frequency. the pll can change between acquisition and tracking modes either automatically or manually. 8.4.2.1 pll circuits the pll consists of these circuits:  voltage-controlled oscillator (vco)  modulo vco frequency divider addr. register name bit 7 6 5 4 3 2 1 bit 0 $005c pll control register (pctl) see page 126. read : pllie pllf pllon bcs 1111 write : rrrrr re- set: 00101111 $005d pll bandwidth control reg- ister (pbwc) see page 129. read : auto lock acq xld 0000 write : rrrrr re- set: 00000000 $005e pll programming register (ppg) see page 131. read : mul7 mul6 mul5 mul4 vrs7 vrs6 vrs5 vrs4 write : re- set: 01100110 r=reserved figure 8-2. cgm i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 116 clock generator module (cgm) motorola clock generator module (cgm)  phase detector  loop filter  lock detector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) functional description mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 117 the operating range of the vco is programmable for a wide range of frequencies and for maximum immunity to external noise, including supply and cgmxfc noise. the vco frequency is bound to a range from roughly one-half to twice the center-of-range frequency, f vrs . modulating the voltage on the cgmxfc pin changes the frequency within this range. by design, f vrs is equal to the nominal center-of-range frequency, f nom , (4.9152 mhz) times a linear factor l, or (l) f nom . cgmrclk is the pll reference clock, a buffered version of cgmxclk. cgmrclk runs at a frequency, f rclk , and is fed to the pll through a buffer. the buffer output is the final reference clock, cgmrdv, running at a frequency, f rdv =f rclk . the vco ? s output clock, cgmvclk, running at a frequency f vclk , is fed back through a programmable modulo divider. the modulo divider reduces the vco clock by a factor, n. the divider ? s output is the vco feedback clock, cgmvdv, running at a frequency, f vdv =f vclk/n . see 8.4.2.4 programming the pll for more information. the phase detector then compares the vco feedback clock, cgmvdv, with the final reference clock, cgmrdv. a correction pulse is generated based on the phase difference between the two signals. the loop filter then slightly alters the dc voltage on the external capacitor connected to cgmxfc based on the width and direction of the correction pulse. the filter can make fast or slow corrections depending on its mode, described in 8.4.2.2 acquisition and tracking modes . the value of the external capacitor and the reference frequency determines the speed of the corrections and the stability of the pll. the lock detector compares the frequencies of the vco feedback clock, cgmvdv, and the final reference clock, cgmrdv. therefore, the speed of the lock detector is directly proportional to the final reference frequency, f rdv . the circuit determines the mode of the pll and the lock condition based on this comparison. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 118 clock generator module (cgm) motorola clock generator module (cgm) 8.4.2.2 acquisition and tracking modes the pll filter is manually or automatically configurable into one of two operating modes:  acquisition mode ? in acquisition mode, the filter can make large frequency corrections to the vco. this mode is used at pll startup or when the pll has suffered a severe noise hit and the vco frequency is far off the desired frequency. when in acquisition mode, the acq bit is clear in the pll bandwidth control register. see 8.6.2 pll bandwidth control register .  tracking mode ? in tracking mode, the filter makes only small corrections to the frequency of the vco. pll jitter is much lower in tracking mode, but the response to noise is also slower. the pll enters tracking mode when the vco frequency is nearly correct, such as when the pll is selected as the base clock source. the pll is automatically in tracking mode when not in acquisition mode or when the acq bit is set. see 8.4.3 base clock selector circuit . 8.4.2.3 manual and automatic pll bandwidth modes the pll can change the bandwidth or operational mode of the loop filter manually or automatically. in automatic bandwidth control mode (auto = 1), the lock detector automatically switches between acquisition and tracking modes. automatic bandwidth control mode also is used to determine when the vco clock, cgmvclk, is safe to use as the source for the base clock, cgmout ( 8.6.2 pll bandwidth control register ). if pll interrupts are enabled, the software can wait for a pll interrupt request and then check the lock bit. if interrupts are disabled, software can poll the lock bit continuously (during pll startup, usually) or at periodic intervals. in either case, when the lock bit is set, the vco clock is safe to use as the source for the base clock (see 8.4.3 base clock selector circuit ). if the vco is selected as the source for the base clock and the lock bit is clear, the pll has suffered a severe noise hit and the software must take appropriate action, depending on the application. see 8.7 interrupts for information and precautions on using interrupts. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) functional description mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 119 these conditions apply when the pll is in automatic bandwidth control mode:  the acq bit (see 8.6.2 pll bandwidth control register ) is a read-only indicator of the mode of the filter. see 8.4.2.2 acquisition and tracking modes .  the acq bit is set when the vco frequency is within a certain tolerance, ? ?  the lock bit is a read-only indicator of the locked state of the pll.  the lock bit is set when the vco frequency is within a certain tolerance, ? ?  cpu interrupts can occur if enabled (pllie = 1) when the pll ? s lock condition changes, toggling the lock bit. see 8.6.1 pll control register . the pll also may operate in manual mode (auto = 0). manual mode is used by systems that do not require an indicator of the lock condition for proper operation. such systems typically operate well below f busmax and require fast startup. these conditions apply when in manual mode:  acq is a writable control bit that controls the mode of the filter. before turning on the pll in manual mode, the acq bit must be clear.  before entering tracking mode (acq = 1), software must wait a given time, t acq (see 8.11 acquisition/lock time specifications ), after turning on the pll by setting pllon in the pll control register (pctl).  software must wait a given time, t al , after entering tracking mode before selecting the pll as the clock source to cgmout (bcs = 1).  the lock bit is disabled.  cpu interrupts from the cgm are disabled. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 120 clock generator module (cgm) motorola clock generator module (cgm) 8.4.2.4 programming the pll this procedure shows how to program the pll. note: the round function in the following equations means that the real number should be rounded to the nearest integer number. 1. choose the desired bus frequency, f busdes . 2. calculate the desired vco frequency (four times the desired bus frequency). 3. choose a practical pll reference frequency, f rclk . 4. select a vco frequency multiplier, n. 5. calculate and verify the adequacy of the vco and bus frequencies f vclk and f bus . 6. select a vco linear range multiplier, l. where f nom = 4.9152 mhz 7. calculate and verify the adequacy of the vco programmed center-of-range frequency, f vrs . f vrs = (l) f nom 8. verify the choice of n and l by comparing f vclk to f vrs and f vclkdes . for proper operation, f vclk must be within the application ? s tolerance of f vclkdes , and f vrs must be as close as possible to f vclk . caution: exceeding the recommended maximum bus frequency or vco frequency can crash the mcu. 9. program the pll registers accordingly: a. in the upper four bits of the pll programming register (ppg), program the binary equivalent of n. b. in the lower four bits of the pll programming register (ppg), program the binary equivalent of l. f vclkdes 4f busdes () ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) functional description mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 121 8.4.2.5 special programming exceptions the programming method described in 8.4.2.4 programming the pll does not account for possible exceptions. a value of 0 for n or l is meaningless when used in the equations given. to account for these exceptions:  a 0 value for n is interpreted exactly the same as a value of 1.  a 0 value for l disables the pll and prevents its selection as the source for the base clock. see 8.4.3 base clock selector circuit . 8.4.3 base clock selector circuit this circuit is used to select either the crystal clock, cgmxclk, or the vco clock, cgmvclk, as the source of the base clock, cgmout. the two input clocks go through a transition control circuit that waits up to three cgmxclk cycles and three cgmvclk cycles to change from one clock source to the other. during this time, cgmout is held in state. the output of the transition control circuit is then divided by two to correct the duty cycle. therefore, the bus clock frequency, which is one-half of the base clock frequency, is one-fourth the frequency of the selected clock (cgmxclk or cgmvclk). the bcs bit in the pll control register (pctl) selects which clock drives cgmout. the vco clock cannot be selected as the base clock source if the pll is not turned on. the pll cannot be turned off if the vco clock is selected. the pll cannot be turned on or off simultaneously with the selection or deselection of the vco clock. the vco clock also cannot be selected as the base clock source if the factor l is programmed to a 0. this value would set up a condition inconsistent with the operation of the pll, so that the pll would be disabled and the crystal clock would be forced as the source of the base clock. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 122 clock generator module (cgm) motorola clock generator module (cgm) 8.4.4 cgm external connections in its typical configuration, the cgm requires seven external components. five of these are for the crystal oscillator and two are for the pll. the crystal oscillator is normally connected in a pierce oscillator configuration, as shown in figure 8-3 . figure 8-3 shows only the logical representation of the internal components and may not represent actual circuitry. the oscillator configuration uses five components: 1. crystal, x 1 2. fixed capacitor, c 1 3. tuning capacitor, c 2 (can also be a fixed capacitor) 4. feedback resistor, r b 5. series resistor, r s (optional) the series resistor (r s ) is included in the diagram to follow strict pierce oscillator guidelines and may not be required for all ranges of operation, especially with high frequency crystals. refer to the crystal manufacturer ? s data for more information. figure 8-3 also shows the external components for the pll:  bypass capacitor, c byp  filter capacitor, c f routing should be done with great care to minimize signal cross talk and noise. see 8.11 acquisition/lock time specifications for routing information and more information on the filter capacitor ? s value and its effects on pll performance. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) i/o signals mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 123 figure 8-3. cgm external connections 8.5 i/o signals the following paragraphs describe the cgm input/output (i/o) signals. 8.5.1 crystal amplifier input pin (osc1) the osc1 pin is an input to the crystal oscillator amplifier. 8.5.2 crystal amplifier output pin (osc2) the osc2 pin is the output of the crystal oscillator inverting amplifier. 8.5.3 external filter capacitor pin (cgmxfc) the cgmxfc pin is required by the loop filter to filter out phase corrections. a small external capacitor is connected to this pin. note: to prevent noise problems, c f should be placed as close to the cgmxfc pin as possible, with minimum routing distances and no routing of other signals across the c f connection. c1 c2 c f simoscen cgmxclk r b x1 r s * c byp osc1 osc2 v ss cgmxfc v dda *r s can be 0 (shorted) when used with higher-frequency crystals. v dd refer to manufacturer ? s data. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 124 clock generator module (cgm) motorola clock generator module (cgm) 8.5.4 pll analog power pin (v dda ) v dda is a power pin used by the analog portions of the pll. connect the v dda pin to the same voltage potential as the v dd pin. note: route v dda carefully for maximum noise immunity and place bypass capacitors as close as possible to the package. 8.5.5 oscillator enable signal (simoscen) the simoscen signal comes from the system integration module (sim) and enables the oscillator and pll. 8.5.6 crystal output frequency signal (cgmxclk) cgmxclk is the crystal oscillator output signal. it runs at the full speed of the crystal (f xclk ) and comes directly from the crystal oscillator circuit. figure 8-3 shows only the logical relation of cgmxclk to osc1 and osc2 and may not represent the actual circuitry. the duty cycle of cgmxclk is unknown and may depend on the crystal and other external factors. also, the frequency and amplitude of cgmxclk can be unstable at startup. 8.5.7 cgm base clock output (cgmout) cgmout is the clock output of the cgm. this signal goes to the sim, which generates the mcu clocks. cgmout is a 50 percent duty cycle clock running at twice the bus frequency. cgmout is software programmable to be either the oscillator output, cgmxclk, divided by two or the vco clock, cgmvclk, divided by two. 8.5.8 cgm cpu interrupt (cgmint) cgmint is the interrupt signal generated by the pll lock detector. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) cgm registers mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 125 8.6 cgm registers these registers control and monitor operation of the cgm:  pll control register (pctl), see 8.6.1 pll control register  pll bandwidth control register (pbwc), see 8.6.2 pll bandwidth control register  pll programming register (ppg), see 8.6.3 pll programming register figure 8-4 is a summary of the cgm registers. addr. register name bit 7 6 5 4 3 2 1 bit 0 $005c pll control register (pctl) see page 126. read : pllie pllf pllon bcs 1111 write : rrrrr re- set: 00101111 $005d pll bandwidth control reg- ister (pbwc) see page 129. read : auto lock acq xld 0000 write : rrrrr re- set: 00000000 figure 8-4. cgm i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 126 clock generator module (cgm) motorola clock generator module (cgm) 8.6.1 pll control register the pll control register (pctl) contains the interrupt enable and flag bits, the on/off switch, and the base clock selector bit. $005e pll programming register (ppg) see page 131. read : mul7 mul6 mul5 mul4 vrs7 vrs6 vrs5 vrs4 write : re- set: 01100110 r= reserved notes: 1. when auto = 0, pllie is forced to logic 0 and is read-only. 2. when auto = 0, pllf and lock read as logic 0. 3. when auto = 1, acq is read-only. 4. when pllon = 0 or vrs[7:4] = $0, bcs is forced to logic 0 and is read-only. 5. when pllon = 1, the pll programming register is read-only. 6. when bcs = 1, pllon is forced set and is read-only. addr. register name bit 7 6 5 4 3 2 1 bit 0 figure 8-4. cgm i/o register summary ad- dress: $005c bit 7654321bit 0 read: pllie pllf pllon bcs 1111 write: r r r r r reset:00101111 r= reserved figure 8-5. pll control register (pctl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) cgm registers mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 127 pllie ? pll interrupt enable bit this read/write bit enables the pll to generate an interrupt request when the lock bit toggles, setting the pll flag, pllf. when the auto bit in the pll bandwidth control register (pbwc) is clear, pllie cannot be written and reads as logic 0. reset clears the pllie bit. 1 = pll interrupts enabled 0 = pll interrupts disabled pllf ? pll interrupt flag bit this read-only bit is set whenever the lock bit toggles. pllf generates an interrupt request if the pllie bit also is set. pllf always reads as logic 0 when the auto bit in the pll bandwidth control register (pbwc) is clear. clear the pllf bit by reading the pll control register. reset clears the pllf bit. 1 = change in lock condition 0 = no change in lock condition note: do not inadvertently clear the pllf bit. any read or read-modify-write operation on the pll control register clears the pllf bit. pllon ? pll on bit this read/write bit activates the pll and enables the vco clock, cgmvclk. pllon cannot be cleared if the vco clock is driving the base clock, cgmout (bcs = 1). reset sets this bit so that the loop can stabilize as the mcu is powering up. see 8.4.3 base clock selector circuit . 1 = pll on 0 = pll off bcs ? base clock select bit this read/write bit selects either the crystal oscillator output, cgmxclk, or the vco clock, cgmvclk, as the source of the cgm output, cgmout. cgmout frequency is one-half the frequency of the selected clock. bcs cannot be set while the pllon bit is clear. after toggling bcs, it may take up to three cgmxclk and three cgmvclk cycles to complete the transition from one source clock to the other. during the transition, cgmout is held in stasis. reset clears the bcs bit. see 8.4.3 base clock selector circuit . 1 = cgmvclk divided by two drives cgmout 0 = cgmxclk divided by two drives cgmout f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 128 clock generator module (cgm) motorola clock generator module (cgm) note: pllon and bcs have built-in protection that prevents the base clock selector circuit from selecting the vco clock as the source of the base clock if the pll is off. therefore, pllon cannot be cleared when bcs is set, and bcs cannot be set when pllon is clear. if the pll is off (pllon = 0), selecting cgmvclk requires two writes to the pll control register. see 8.4.3 base clock selector circuit . pctl bits 3 ? 0 ? unimplemented bits these bits provide no function and always read as logic 1s. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) cgm registers mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 129 8.6.2 pll bandwidth control register the pll bandwidth control register:  selects automatic or manual (software-controlled) bandwidth control mode  indicates when the pll is locked  in automatic bandwidth control mode, indicates when the pll is in acquisition or tracking mode  in manual operation, forces the pll into acquisition or tracking mode auto ? automatic bandwidth control bit this read/write bit selects automatic or manual bandwidth control. when initializing the pll for manual operation (auto = 0), clear the acq bit before turning on the pll. reset clears the auto bit. 1 = automatic bandwidth control 0 = manual bandwidth control lock ? lock indicator bit when the auto bit is set, lock is a read-only bit that becomes set when the vco clock, cgmvclk, is locked (running at the programmed frequency). when the auto bit is clear, lock reads as logic 0 and has no meaning. reset clears the lock bit. 1 = vco frequency correct or locked 0 = vco frequency incorrect or unlocked ad- dress: $005d bit 7654321bit 0 read: auto lock acq xld 0000 write: r r r r r reset:00000000 r= reserved figure 8-6. pll bandwidth control register (pbwc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 130 clock generator module (cgm) motorola clock generator module (cgm) acq ? acquisition mode bit when the auto bit is set, acq is a read-only bit that indicates whether the pll is in acquisition mode or tracking mode. when the auto bit is clear, acq is a read/write bit that controls whether the pll is in acquisition or tracking mode. in automatic bandwidth control mode (auto = 1), the last-written value from manual operation is stored in a temporary location and is recovered when manual operation resumes. reset clears this bit, enabling acquisition mode. 1 = tracking mode 0 = acquisition mode xld ? crystal loss detect bit when the vco output, cgmvclk, is driving cgmout, this read/write bit can indicate whether the crystal reference frequency is active or not. to check the status of the crystal reference, follow these steps: 1. write a logic 1 to xld. 2. wait n ? 0 ? reserved for test these bits enable test functions not available in user mode. to ensure software portability from development systems to user applications, software should write 0s to pbwc[3:0] whenever writing to pbwc. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) cgm registers mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 131 8.6.3 pll programming register the pll programming register (ppg) contains the programming information for the modulo feedback divider and the programming information for the hardware configuration of the vco. mul[7:4] ? multiplier select bits these read/write bits control the modulo feedback divider that selects the vco frequency multiplier, n. see 8.4.2.1 pll circuits and 8.4.2.4 programming the pll . a value of $0 in the multiplier select bits configures the modulo feedback divider the same as a value of $1. reset initializes these bits to $6 to give a default multiply value of 6. note: the multiplier select bits have built-in protection that prevents them from being written when the pll is on (pllon = 1). ad- dress: $005e bit 7654321bit 0 read: mul7 mul6 mul5 mul4 vrs7 vrs6 vrs5 vrs4 write: reset:01100110 figure 8-7. pll programming register (ppg) table 8-1. vco frequency multiplier (n) selection mul7:mul6:mul5:mul4 vco frequency multiplier (n) 0000 1 0001 1 0010 2 0011 3 1101 13 1110 14 1111 15 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 132 clock generator module (cgm) motorola clock generator module (cgm) vrs[7:4] ? vco range select bits these read/write bits control the hardware center-of-range linear multiplier l, which controls the hardware center-of-range frequency f vrs . see 8.4.2.1 pll circuits , 8.4.2.4 programming the pll , and 8.6.1 pll control register . vrs[7:4] cannot be written when the pllon bit in the pll control register (pctl) is set. see 8.4.2.5 special programming exceptions . a value of $0 in the vco range select bits disables the pll and clears the bcs bit in the pctl. see 8.4.3 base clock selector circuit and 8.4.2.5 special programming exceptions for more information. reset initializes the bits to $6 to give a default range multiply value of 6. note: the vco range select bits have built-in protection that prevents them from being written when the pll is on (pllon = 1) and prevents selection of the vco clock as the source of the base clock (bcs = 1) if the vco range select bits are all clear. the vco range select bits must be programmed correctly. incorrect programming may result in failure of the pll to achieve lock. 8.7 interrupts when the auto bit is set in the pll bandwidth control register (pbwc), the pll can generate a cpu interrupt request every time the lock bit changes state. the pllie bit in the pll control register (pctl) enables cpu interrupts from the pll. pllf, the interrupt flag in the pctl, becomes set whether interrupts are enabled or not. when the auto bit is clear, cpu interrupts from the pll are disabled and pllf reads as logic 0. software should read the lock bit after a pll interrupt request to see if the request was due to an entry into lock or an exit from lock. when the pll enters lock, the vco clock, cgmvclk, divided by two can be selected as the cgmout source by setting bcs in the pctl. when the pll exits lock, the vco clock frequency is corrupt, and appropriate precautions should be taken. if the application is not f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) wait mode mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 133 frequency-sensitive, interrupts should be disabled to prevent pll interrupt service routines from impeding software performance or from exceeding stack limitations. note: software can select the cgmvclk divided by two as the cgmout source even if the pll is not locked (lock = 0). therefore, software should make sure the pll is locked before setting the bcs bit. 8.8 wait mode the wait instruction puts the mcu in low power-consumption standby mode. the wait instruction does not affect the cgm. before entering wait mode, software can disengage and turn off the pll by clearing the bcs and pllon bits in the pll control register (pctl). less power-sensitive applications can disengage the pll without turning it off. applications that require the pll to wake the mcu from wait mode also can deselect the pll output without turning off the pll. 8.9 stop mode the stop instruction puts the mcu in low power-consumption standby mode. the stop instruction disables the cgmc (oscillator and phase-lock loop) and holds the cgm outputs low. 8.10 cgm during break mode the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. see 7.7.5 sim break flag control register . to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 134 clock generator module (cgm) motorola clock generator module (cgm) to protect the pllf bit during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write the pll control register during the break state without affecting the pllf bit. 8.11 acquisition/lock time specifications the acquisition and lock times of the pll are, in many applications, the most critical pll design parameters. proper design and use of the pll ensures the highest stability and lowest acquisition/lock times. 8.11.1 acquisition/lock time definitions typical control systems refer to the acquisition time or lock time as the reaction time, within specified tolerances, of the system to a step input. in a pll, the step input occurs when the pll is turned on or when it suffers a noise hit. the tolerance is usually specified as a percent of the step input or when the output settles to the desired value plus or minus a percent of the frequency change. therefore, the reaction time is constant in this definition, regardless of the size of the step input. for example, consider a system with a 5 percent acquisition time tolerance. if a command instructs the system to change from 0 hz to 1 mhz, the acquisition time is the time taken for the frequency to reach 1mhz ? 100-khz noise hit, the acquisition time is the time taken to return from 900 khz to 1mhz f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) acquisition/lock time specifications mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 135 the discrepancy in these definitions makes it difficult to specify an acquisition or lock time for a typical pll. therefore, the definitions for acquisition and lock times for this module are:  acquisition time, t acq , is the time the pll takes to reduce the error between the actual output frequency and the desired output frequency to less than the tracking mode entry tolerance, ? ? f orig )/f des , of not more than  lock time, t lock , is the time the pll takes to reduce the error between the actual output frequency and the desired output frequency to less than the lock mode entry tolerance, ? ? f orig )/f des , of not more than f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 136 clock generator module (cgm) motorola clock generator module (cgm) another critical parameter is the external filter capacitor. the pll modifies the voltage on the vco by adding or subtracting charge from this capacitor. therefore, the rate at which the voltage changes for a given frequency error (thus change in charge) is proportional to the capacitor size. the size of the capacitor also is related to the stability of the pll. if the capacitor is too small, the pll cannot make small enough adjustments to the voltage and the system cannot lock. if the capacitor is too large, the pll may not be able to adjust the voltage in a reasonable time. see 8.11.3 choosing a filter capacitor . also important is the operating voltage potential applied to v dda . the power supply potential alters the characteristics of the pll. a fixed value is best. variable supplies, such as batteries, are acceptable if they vary within a known range at very slow speeds. noise on the power supply is not acceptable, because it causes small frequency errors which continually change the acquisition time of the pll. temperature and processing also can affect acquisition time because the electrical characteristics of the pll change. the part operates as specified as long as these influences stay within the specified limits. external factors, however, can cause drastic changes in the operation of the pll. these factors include noise injected into the pll through the filter capacitor, filter capacitor leakage, stray impedances on the circuit board, and even humidity or circuit board contamination. 8.11.3 choosing a filter capacitor as described in 8.11.2 parametric influences on reaction time , the external filter capacitor, c f , is critical to the stability and reaction time of the pll. the pll is also dependent on reference frequency and supply voltage. the value of the capacitor must, therefore, be chosen with supply potential and reference frequency in mind. for proper operation, the external filter capacitor must be chosen according to this equation: for acceptable values of c fact , see 8.11 acquisition/lock time specifications . for the value of v dda , choose the voltage potential at which the mcu is operating. if the power supply is variable, choose a value near the middle of the range of possible supply values. c f c fact v dda f rdv ----------------- ?? ?? ?? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clock generator module (cgm) acquisition/lock time specifications mc68hc908mr8 ? rev 4.0 technical data motorola clock generator module (cgm) 137 this equation does not always yield a commonly available capacitor size, so round to the nearest available size. if the value is between two different sizes, choose the higher value for better stability. choosing the lower size may seem attractive for acquisition time improvement, but the pll can become unstable. also, always choose a capacitor with a tight tolerance (  correct selection of filter capacitor, c f ; see 8.11.3 choosing a filter capacitor  room temperature operation  negligible external leakage on cgmxfc  negligible noise the k factor in the equations is derived from internal pll parameters. k acq is the k factor when the pll is configured in acquisition mode, and k trk is the k factor when the pll is configured in tracking mode. see 8.4.2.2 acquisition and tracking modes . note: inverse proportionality between the lock time and the reference frequency in automatic bandwidth control mode, the acquisition and lock times are quantized into units based on the reference frequency, see 8.4.2.3 manual and automatic pll bandwidth modes . a certain number of clock cycles, n acq , is required to ascertain that the pll is within the tracking mode entry tolerance, ? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 138 clock generator module (cgm) motorola clock generator module (cgm) certain number of clock cycles, n trk , is required to ascertain that the pll is within the lock mode entry tolerance, ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 139 technical data ? mc68hc908mr8 section 9. pulse-width modulator for motor control (pwmmc) 9.1 contents 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 9.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 9.4 timebase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 9.4.1 resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 9.4.2 prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9.5 pwm generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9.5.1 load operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9.5.2 pwm data overflow and underflow conditions . . . . . . 152 9.6 output control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 9.6.1 selecting six independent pwms or three complementary pwm pairs . . . . . . . . . . . . . . . . . . . . . . . 152 9.6.2 dead-time insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 9.6.3 output polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 9.6.4 output port control register . . . . . . . . . . . . . . . . . . . . . 159 9.7 fault protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 9.7.1 fault condition input pins . . . . . . . . . . . . . . . . . . . . . . . . 164 9.7.2 software output disable . . . . . . . . . . . . . . . . . . . . . . . . . 168 9.7.3 output port control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 9.8 initialization and the pwmen bit . . . . . . . . . . . . . . . . . . . . . 169 9.9 pwm operation in wait mode . . . . . . . . . . . . . . . . . . . . . . . 170 9.10 pwm operation in stop mode . . . . . . . . . . . . . . . . . . . . . . . 170 9.11 pwm operation in break mode . . . . . . . . . . . . . . . . . . . . . . 171 9.12 control logic block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 9.12.1 pwm counter registers . . . . . . . . . . . . . . . . . . . . . . . . . 172 9.12.2 pwm counter modulo registers . . . . . . . . . . . . . . . . . . . 173 9.12.3 pwmx value registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 9.12.4 pwm control register 1 . . . . . . . . . . . . . . . . . . . . . . . . . 175 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 140 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.12.5 pwm control register 2 . . . . . . . . . . . . . . . . . . . . . . . . . 177 9.12.6 dead-time write-once register . . . . . . . . . . . . . . . . . . . 179 9.12.7 pwm disable mapping write-once register . . . . . . . . . 179 9.12.8 fault control register . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 9.12.9 fault status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 9.12.10 fault acknowledge register . . . . . . . . . . . . . . . . . . . . . . 182 9.12.11 pwm output control register . . . . . . . . . . . . . . . . . . . . . 184 9.13 pwm glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 9.2 introduction this section describes the pulse-width modulator for motor control (pwmmc, version a). the mc68hc908mr8 pwm module can generate three complementary pwm pairs or six independent pwm signals. these pwm signals can be center-aligned or edge-aligned. a block diagram of the pwm module is shown in figure 9-1 . a 12-bit timer pwm counter is common to all six channels. pwm resolution is one clock period for edge-aligned operation and two clock periods for center-aligned operation. the clock period is dependent on the internal operating frequency (f op ) and a programmable prescaler. the highest resolution for edge-aligned operation is 125 ns (f op = 8 mhz). the highest resolution for center-aligned operation is 250 ns (f op = 8 mhz). when generating complementary pwm signals, the module features automatic dead-time insertion to the pwm output pairs. a summary of the pwm registers is shown in figure 9-2 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) features mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 141 9.3 features features of the pwmmc include:  three complimentary pwm pairs or six independent pwm signals  edge-aligned pwm signals or center-aligned pwm signals  pwm signal polarity control  manual pwm output control through software  programmable fault protection  complimentary mode also features: ? dead-time insertion ? separate top/bottom pulse width correction via current sensing or programmable software bits figure 9-1. pwm module block diagram pwm1 pin pwm2 pin pwm channels 3 & 4 pwm3 pin pwm4 pin pwm channels 5 & 6 pwm5 pin pwm6 pin timebase cpu bus output control 2 fault interrupt pins 12 control logic block 8 pwm channels 1 & 2 fault protection f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 142 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control addr. register name bit 7 6 5 4 3 2 1 bit 0 $0020 pwm control register 1 (pctl1) see page 175. read: disx disy pwmin t pwmf ldok pwme n write: reset : 00 0 0 0 0 0 0 $0021 pwm control register 2 (pctl2) see page 177. read: ldfq1 ldfq0 0 sel12 sel34 sel56 prsc1 prsc0 write: reset : 00 0 0 0 0 0 0 $0022 fault control register (fcr) see page 180. read: fint4 fmode 4 fint1 fmode 1 write: reset : 00 0 0 0 0 0 0 $0023 fault status register (fsr) see page 181. read: fpin4 fflag 4 00 0 0fpin1 fflag 1 write: reset : u0 u 0 u 0 u 0 $0024 fault acknowledge register (ftack) see page 182. read: 00 0 0 0 0 0 0 write: ftack 4 ftack 1 reset : 00 0 0 0 0 0 0 $0025 pwm output control (pwmout) see page 159. read: 0 outct l out6 out5 out4 out3 out2 out1 write: reset : 00 0 0 0 0 0 0 $0026 pwm counter register high (pcnth) see page 172. read: 0 0 0 0 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 u = unaffected x = indeter- minate r = reserved bold = buff- ered figure 9-2. register summary (sheet 1 of 4) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) features mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 143 $0027 pwm counter register low (pcntl) see page 172. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $0028 pwm counter modulo register high (pmodh) see page 173. read: 00 0 0 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 x x xx $0029 pwm counter modulo register low (pmodl) see page 173. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : xx x x x x x x $002a pwm 1 value register high (pval1h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 $002b pwm 1 value register low (pval1l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $002c pwm 2 value register high (pval2h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 $002d pwm 2 value register low (pval2l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indeter- minate r = reserved bold = buff- ered figure 9-2. register summary (sheet 2 of 4) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 144 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control $002e pwm 3 value register high (pval3h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 $002f pwm 3 value register low (pval3l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $0030 pwm 4 value register high (pval4h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 $0031 pwm 4 value register low (pval4l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $0032 pwm 5 value register high (pmval5h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 $0033 pwm 5 value register low (pval5l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $0034 pwm 6 value register high (pval6h) see page 174. read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset : 00 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indeter- minate r = reserved bold = buff- ered figure 9-2. register summary (sheet 3 of 4) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) features mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 145 $0035 pwm 6 value register low (pmval6l) see page 174. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 00 0 0 0 0 0 0 $0036 dead-time write-once register (deadtm) see page 179. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 11 1 1 1 1 1 1 $0037 pwm disable mapping write-once register (dismap) see page 179. read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset : 11 1 1 1 1 1 1 addr. register name bit 7 6 5 4 3 2 1 bit 0 u = unaffected x = indeter- minate r = reserved bold = buff- ered figure 9-2. register summary (sheet 4 of 4) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 146 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.4 timebase this subsection provides for a discussion of the timebase. 9.4.1 resolution in center-aligned mode, a 12-bit up/down counter is used to create the pwm period. therefore, the pwm resolution in center-aligned mode is two clocks (highest resolution is 250 ns @ f op = 8 mhz) as shown in figure 9-3 . the up/down counter uses the value in the timer modulus register to determine its maximum count. the pwm period will equal: (timer modulus) x (pwm clock period) x 2 for edge-aligned mode, a 12-bit up-only counter is used to create the pwm period. therefore, the pwm resolution in edge-aligned mode is one clock (highest resolution is 125 ns @ f op = 8 mhz) as shown in figure 9-4 . again, the timer modulus register is used to determine the maximum count. the pwm period will equal: (timer modulus) x (pwm clock period) center-aligned operation versus edge-aligned operation is determined by the option edge. see 5.4 config bits . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) timebase mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 147 figure 9-3. center-aligned pwm (positive polarity) figure 9-4. edge-aligned pwm (positive polarity) up/down counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 period = 8 x (pwm clock period) up-only counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 period = 4 x (pwm clock period) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 148 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.4.2 prescaler to permit lower pwm frequencies, a prescaler is provided which will divide the pwm clock frequency by 1, 2, 4, or 8. table 9-1 shows how setting the prescaler bits in pwm control register 2 affects the pwm clock frequency. this prescaler is buffered and will not be used by the pwm generator until the ldok bit is set and a new pwm reload-cycle begins. 9.5 pwm generators this subsection describes the pulse-width modulator (pwm) generators. 9.5.1 load operation to help avoid erroneous pulse widths and pwm periods, the modulus, prescaler, and pwm value registers are buffered. new pwm values, counter modulus values, and prescalers can be loaded from their buffers into the pwm module every one, two, four, or eight pwm cycles. ldfq1:ldfq0 in pwm control register 2 are used to control this reload frequency, as shown in table 9-2 . when a reload cycle arrives, regardless of whether an actual reload occurs (as determined by the ldok bit), the pwm reload flag bit in pwm control register 1 will be set. if the pwmint bit in pwm control register 1 is set, a cpu interrupt request will be generated when pwmf is set. software can use this interrupt to calculate new pwm parameters in real time for the pwm module. table 9-1. pwm prescaler prescaler bits prsc1:prsc0 pwm clock frequency 00 f op 01 f op /2 10 f op /4 11 f op /8 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) pwm generators mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 149 for ease of software, the ldfqx bits are buffered. when the ldfqx bits are changed, the reload frequency will not change until the previous reload cycle is completed. see figure 9-5 . note: when reading the ldfqx bits, the value is the buffered value (for example, not necessarily the value being acted upon). figure 9-5. reload frequency change pwmint enables cpu interrupt requests as shown in figure 9-6 . when this bit is set, cpu interrupt requests are generated when the pwmf bit is set. when the pwmint bit is clear, pwm interrupt requests are inhibited. pwm reloads will still occur at the reload rate, but no interrupt requests will be generated. table 9-2. pwm reload frequency reload frequency bits ldfq1:ldfq0 pwm reload frequency 00 every pwm cycle 01 every 2 pwm cycles 10 every 4 pwm cycles 11 every 8 pwm cycles reload reload reload reload reload reload reload change reload frequency to every 4 cycles change reload frequency to every cycle f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 150 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-6. pwm interrupt requests to prevent a partial reload of pwm parameters from occurring while the software is still calculating them, an interlock bit controlled from software is provided. this bit informs the pwm module that all the pwm parameters have been calculated, and it is okay to use them. a new modulus, prescaler, and/or pwm value cannot be loaded into the pwm module until the ldok bit in pwm control register 1 is set. when the ldok bit is set, these new values are loaded into a second set of registers and used by the pwm generator at the beginning of the next pwm reload cycle as shown in figure 9-7 , figure 9-8 , figure 9-9 , and figure 9-10 . after these values are loaded, the ldok bit is cleared. note: when the pwm module is enabled (via the pwmen bit), a load will occur if the ldok bit is set. even if it is not set, an interrupt will occur if the pwmint bit is set. to prevent this, the software should clear the pwmint bit before enabling the pwm module. figure 9-7. center-aligned pwm value loading latch v dd cpu interrupt reset d ck pwmint pwmf pwm reload read pwmf as 1, write pwmf as 0 or reset request ldok = 1 modulus = 3 pwm value= 1 ldok = 1 modulus = 3 pwm value= 2 up/down counter pwm ldfq1:ldfq0 = 00 (reload every cycle) ldok = 0 modulus = 3 pwm value= 2 ldok = 0 modulus = 3 pwm value= 1 pwmf set pwmf set pwmf set pwmf set f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) pwm generators mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 151 figure 9-8. center-aligned loading of modulus figure 9-9. edge-aligned pwm value loading figure 9-10. edge-aligned modulus loading ldok = 1 pwm value = 1 modulus = 2 ldok = 1 pwm value= 1 modulus = 3 ldok = 1 pwmvalue= 1 modulus = 2 ldok = 1 pwm value= 1 modulus = 1 ldok = 0 pwm value= 1 modulus = 2 up/down counter pwm ldfq1:ldfq0 = 00 (reload every cycle) pwmf set pwmf set pwmf set pwmf set pwmf set ldok = 1 modulus = 3 pwm value= 1. ldok = 1 modulus = 3 pwm value = 2 up-only counter pwm ldfq1:ldfq0 = 00 (reload every cycle) ldok = 0 modulus = 3 pwm value= 2. ldok = 0 modulus = 3 pwm value = 1 ldok = 0 modulus = 3 pwm value = 1 pwmf set pwmf set pwmf set pwmf set pwmf set ldok = 1 modulus = 3 pwm value= 2 ldok = 1 modulus = 4 pwm value = 2 ldok = 1 modulus = 2 pwm value = 2 up-only counter pwm ldfq1:ldfq0 = 00 (reload every cycle) ldok = 0 modulus = 1 pwm value= 2 pwmf set pwmf set pwmf set pwmf set f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 152 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.5.2 pwm data overflow and underflow conditions the pwm value registers are 16-bit registers. although the counter is only 12 bits, the user may write a 16-bit signed value to a pwm value register. as shown in figure 9-3 and figure 9-4 , if the pwm value is less than or equal to 0, the pwm will be inactive for the entire period. conversely, if the pwm value is greater than or equal to the timer modulus, the pwm will be active for the entire period. refer to table 9-3 . note: the terms active and inactive refer to the asserted and negated states of the pwm signals and should not be confused with the high- impedance state of the pwm pins. 9.6 output control this subsection discusses output control. 9.6.1 selecting six independent pwms or three complementary pwm pairs the pwm outputs can be configured as six independent pwm channels or three complementary channel pairs. the option indep determines which mode is used (see 5.4 config bits ). if complementary operation is chosen, the pwm pins are paired as shown in figure 9-11 . operation of one pair is then determined by one pwm value register. this type of operation is meant for use in motor drive circuits such as the one in figure 9-12 . table 9-3. pwm data overflow and underflow conditions pwmvalxh:pwmvalxl condition pwm value used $0000 ? $0fff normal per registers contents $1000 ? $7fff overflow $fff $8000 ? $ffff underflow $000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) output control mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 153 figure 9-11. complementary pairing figure 9-12. typical ac motor drive when complementary operation is used, two additional features are provided:  dead-time insertion  separate top/bottom pulse width correction to correct for distortions caused by the motor drive characteristics. if independent operation is chosen, each pwm has its own pwm value register. pwm value register pwms 1 & 2 pwms 3 & 4 pwms 5 & 6 output control pwm value register pwm value register pwm1 pwm2 pwm3 pwm4 pwm5 pwm6 (polarity & dead-time insertion) pwm 1 pwm 2 pwm 3 pwm 4 pwm 5 pwm 6 ac to motor inputs f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 154 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.6.2 dead-time insertion as shown in figure 9-12 , in complementary mode, each pwm pair can be used to drive top-side/bottom-side transistors. note: when controlling dc-to-ac inverters such as this, the top and bottom pwms in one pair should never be active at the same time. in figure 9-12 , if pwm1 and pwm2 were on at the same time, large currents would flow through the two transistors as they discharge the bus capacitor. the igbts could be weakened or destroyed. simply forcing the two pwms to be inversions of each other is not always sufficient. since a time delay is associated with turning off the transistors in the motor drive, there must be a ? dead-time ? between the deactivation of one pwm and the activation of the other. a dead-time can be specified in the dead-time write-once register. this 8-bit value specifies the number of cpu clock cycles to use for the dead-time. the dead-time is not affected by changes in the pwm period caused by the prescaler. dead-time insertion is achieved by feeding the top pwm outputs of the pwm generator into dead-time generators, as shown in figure 9-13 . when output control is enabled, the odd out bits, rather than the pwm generator outputs, are fed into the dead-time generators. see 9.6.4 output port control register . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) output control mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 155 figure 9-13. dead-time generators whenever an input to a dead-time generator transitions, a dead-time is inserted (for example, both pwms in the pair are forced to their inactive state). the bottom pwm signal is generated from the top pwm and the dead-time. in the case of output control enabled, the odd outx bits control the top pwms, the even outx bits control the bottom pwms with respect to the odd outx bits (see table 9-4 ). figure 9-14 shows the effects of the dead-time insertion. examples of dead-time insertion are shown in figure 9-14 through figure 9-16 . figure 9-15 shows the effects of dead-time insertion at the duty cycle boundaries (near 0% and 100% duty cycles). figure 9-16 shows the effects of dead-time insertion on pulse widths smaller than the dead-time. fault polarity/output drive pwmpair12 pwmpair34 pwmpair56 mux pwm(top) outx select predt(top) dead timer top/bottom generation postdt (top) top/bottom generation top/bottom generation top bottom top bottom top bottom pwm1 pwm2 pwm3 pwm4 pwm5 pwm6 mux pwm (top) outx select predt (top) mux pwm (top) outx select predt (top) mux pwm (top) outx select predt (top) dead-time dead timer postdt (top) dead-time dead timer postdt (top) dead-time (top) (top) (top) (pwm1) (pwm2) (pwm3) (pwm4) (pwm5) (pwm6) output control out1 out3 out5 outctl out2 out4 out6 (outctl) pwm generator sel1 ? sel6 mux pwm gen[1:6] 6 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 156 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-14. effects of dead-time insertion figure 9-15. dead-time at duty cycle boundaries pwm value = 2 pwm value = 2 pwm value = 3 pwm1 w/ pwm2 w/ pwm1 w/ pwm2 w/ no dead-time no dead-time dead-time = 2 dead-time = 2 2 2 2 2 up/down counter modulus = 4 22 up/down counter modulus = 3 pwm value = 1 pwm value = 3 pwm value = 3 pwm1 w/ no dead-time pwm2 w/ no dead-time pwm1 w/ dead-time = 2 pwm2 w/ dead-time = 2 2 2 2 2 pwm value = 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) output control mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 157 figure 9-16. dead-time and small pulse widths 9.6.3 output polarity the output polarity of the pwms is determined by two options: topneg and botneg. the top polarity option, topneg, controls the polarity of pwms 1, 3, and 5. the bottom polarity option, botneg, controls the polarity of pwms 2, 4, and 6. positive polarity means that when the pwm is active, the pwm output is high. conversely, negative polarity means that when the pwm is active, pwm output is low. see figure 9-17 . note: both bits are found in the config register, which is a write-once register. this reduces the chances of the software inadvertently changing the polarity of the pwm signals and possibly damaging the motor drive hardware. 3 3 3 3 3 3 up/down counter modulus = 3 pwm value = 2 pwm value = 3 pwm value = 2 pwm value= 1 pwm1 w/ no dead-time pwm2 w/ no dead-time pwm1 w/ dead-time = 3 pwm2 w/ dead-time = 3 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 158 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-17. pwm polarity up/down counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 up-only counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 center-aligned positive polarity edge-aligned positive polarity up/down counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 up-only counter modulus = 4 pwm = 0 pwm = 1 pwm = 2 pwm = 3 pwm = 4 center-aligned negative polarity edge-aligned negative polarity f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) output control mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 159 9.6.4 output port control register conditions may arise in which the pwm pins need to be individually controlled. this is made possible by the pwm output control register (pwmout) shown in figure 9-18 . if the outctl bit is set, the pwm pins can be controlled by the outx bits. these bits behave according to table 9-4 . when outctl is set, the polarity options toppol and botpol will still affect the outputs. in addition, if complementary operation is in use, the pwm pairs will not be allowed to be active simultaneously, and dead-time will still not be violated. when outctl is set and ad- dress: $0025 bit 7654321bit 0 read: 0 out- ctl out6 out5 out4 out3 out2 out1 write: reset:00000000 = unimplement- ed figure 9-18. pwm output control register (pwmout) table 9-4. outx bits outx bit complementary mode independent mode out1 1 ? pwm1 is active. 0 ? pwm1 is inactive. 1 ? pwm1 is active 0 ? pwm1 is inactive out2 1 ? pwm2 is complement of pwm1. 0 ? pwm2 is inactive. 1 ? pwm2 is active 0 ? pwm2 is inactive out3 1 ? pwm3 is active. 0 ? pwm3 is inactive. 1 ? pwm3 is active 0 ? pwm3 is inactive out4 1 ? pwm4 is complement of pwm3. 0 ? pwm4 is inactive. 1 ? pwm4 is active 0 ? pwm4 is inactive out5 1 ? pwm5 is active. 0 ? pwm5 is inactive. 1 ? pwm5 is active 0 ? pwm5 is inactive out6 1 ? pwm6 is complement of pwm5. 0 ? pwm6 is inactive. 1 ? pwm6 is active 0 ? pwm6 is inactive f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 160 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control complimentary operation is in use, the odd outx bits are inputs to the dead-time generators as shown in figure 9-14 . dead-time is inserted whenever the odd outx bit toggles as shown in figure 9-19 . although dead-time is not inserted when the even outx bits change, there will be no dead-time violation as shown in figure 9-20 . setting the outctl bit does not disable the pwm generator and current sensing circuitry. they continue to run, but are no longer controlling the output pins. in addition, outctl will control the pwm pins even when pwmen = 0. when outctl is cleared, the outputs of the pwm generator become the inputs to the dead-time and output circuitry at the beginning of the next pwm cycle. note: to avoid an unexpected dead-time occurrence, it is recommended that the outx bits be cleared prior to entering and prior to exiting individual pwm output control mode. figure 9-19. dead-time insertion during outctl = 1 up/down counter modulus=4 pwm1 pwm2 dead-time = 2 outctl out1 out2 2 pwm1/pwm2 2 2 dead-time inserted as part of normal pwm operation as controlled by current sensing and pwm generator dead-time inserted due to setting of out1 bit dead-time inserted due to clearing of out1 bit pwm value = 3 dead-time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) fault protection mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 161 figure 9-20. dead-time insertion during outctl = 1 9.7 fault protection conditions may arise in the external drive circuitry which require that the pwm signals become inactive immediately, such as an overcurrent fault condition. furthermore, it may be desirable to selectively disable pwm(s) solely with software. one or more pwm pins can be disabled (forced to their inactive state) by applying a logic high to either of the two external fault pins or by writing a logic high to either of the disable bits (disx and disy in pwm control register 1). figure 9-21 shows the structure of the pwm disabling scheme. while the pwm pins are disabled, they are forced to their inactive state. the pwm generator continues to run ? only the output pins are disabled up/down counter modulus = 4 dead-time = 2 outctl pwm1 pwm2 out1 out2 2 pwm1/pwm2 2 2 pwm value = 3 dead-time inserted because when outctl was set, the state of out1 was such that pwm1 was directed to toggle dead-times inserted because out1 toggles, directing pwm1 to toggle. no dead-time inserted because out1 is not toggling. dead-time 2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 162 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-21. pwm disabling scheme to allow for different motor configurations and the controlling of more than one motor, the pwm disabling function is organized as two banks, bank x and bank y. bank information combines with information from the disable mapping register to allow selective pwm disabling. fault fint4 cycle start logic high for fault bank y fmode4 disy clear by writing 1 to ftack4 interrupt request shot sq r sq r sq r one fpin4 fflag4 manual mode auto mode software x disable fault pin 4 disable the example is of fault pin 4 with disy. note: in manual mode (fmode = 0), fault 4 may be cleared only if a logic level low at the input of the fault pin is present. fault pin4 disable two sample filter fault pin1 fint1 cycle start logic high for fault bank x disable fmode1 clear by writing 1 to ftack1 interrupt request two shot sq r sq r sample filter one fflag1 manual mode auto mode fault pin 1 disable the example is of fault pin 1. note: in manual mode (fmode = 0), fault 1 may be cleared regardless of the logic level at the input of the fault pin. fpin1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) fault protection mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 163 pin 1 and pwm disable bit x constitute the disabling function of bank x. fault pin 4 and pwm disable bit y constitute the disabling function of bank y. figure 9-22 and figure 9-23 show the disable mapping write-once register and the decoding scheme of the bank which selectively disables pwm(s). when all bits of the disable mapping register are set, any disable condition will disable all pwms. a fault can also generate a cpu interrupt. each fault pin has its own interrupt vector. ad- dress: $0037 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:11111111 figure 9-22. pwm disable mapping write-once register (dismap) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 164 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-23. pwm disabling decode scheme 9.7.1 fault condition input pins a logic high level on a fault pin disables the respective pwm(s) determined by the bank and the disable mapping register. each fault pin incorporates a filter to assist in rejecting spurious faults. all of the external fault pins are software-configurable to re-enable the pwms either with the fault pin (automatic mode) or with software (manual mode). each fault pin has an associated fmode bit to control the pwm re-enabling method. automatic mode is selected by setting the fmodex bit in the fault control register. manual mode is selected when fmodex is clear. note: portc, when used as an input port, mirrors the state of the fault input pins, as portc has the capability of being used as an output port. when either pin of portc is set as an output, by setting its respective portc data direction register bit, the respective fault pin logic is disconnected from that pin and the fault input will be defaulted to normal bit 7 bit 3 bit 0 bit 1 bit 2 bit 4 bit 5 bit 6 disable disable disable disable disable disable pwm pin 1 pwm pin 2 pwm pin 3 pwm pin 4 pwm pin 5 pwm pin 6 bank x disable disable bank y f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) fault protection mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 165 non-fault condition to facilitate the use of portc as an output pin and not interfere with the pwm generator. to regain the fault capability for the respective fault input pin, clear the portc data direction register bit for that pin. additionally, when the device is reset, by default, portc is configured as an input. if either bit(s) of portc is intended to be used as an output, the logic state of the driven device ? s input is indeterminate. the state of the driven device, if at a logic one will drive the respective bit of portc input high, thus causing a fault to be input to the respective portc input and to the pwm module. after setting the portc data direction register, clear the respective fault bits by writing a 1 to bit(s) 0 and or bit 6 in the ftack fault acknowledge register (ftack) and fault status registers (fsr), based on which portc bits that are used as output(s). 9.7.1.1 fault pin filter the two fault pins incorporate a filter to assist in determining a genuine fault condition. after a fault pin has been logic low for one cpu cycle, a rising edge (logic high) will be synchronously sampled once per cpu cycle for two cycles. if both samples are detected logic high, the corresponding fpin bit and fflag bit will be set. the fpin bit will remain set until the corresponding fault pin is logic low and synchronously sampled once in the following cpu cycle. 9.7.1.2 automatic mode in automatic mode, the pwm(s) are disabled immediately once a filtered fault condition is detected (logic high). the pwm(s) remain disabled until the filtered fault condition is cleared (logic low) and a new pwm cycle begins as shown in figure 9-24 . clearing the corresponding fflagx event bit will not enable the pwms in automatic mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 166 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-24. pwm disabling in automatic mode the filtered fault pin ? s logic state is reflected in the respective fpinx bit. any write to this bit is overwritten by the pin state. the fflagx event bit is set with each rising edge of the respective fault pin after filtering has been applied. to clear the fflagx bit, the user must write a 1 to the corresponding ftackx bit. if the fintx bit is set, a fault condition resulting in setting the corresponding fflag bit will also latch a cpu interrupt request. the interrupt request latch is not cleared until one of these actions occurs:  the fflagx bit is cleared by writing a 1 to the corresponding ftackx bit.  the fintx bit is cleared. (this will not clear the fflagx bit.)  reset ? a reset automatically clears all four interrupt latches. if prior to a vector fetch the interrupt request latch is cleared by one of the above actions, a cpu interrupt will no longer be requested. a vector fetch does not alter the state of the pwms, the fflagx event flag, or fintx. note: if the fflagx or fintx bits are not cleared during the interrupt service routine, the interrupt request latch will not be cleared. pwm(s) enabled pwm(s) enabled pwm(s) disabled (inactive) filtered fault pin f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) fault protection mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 167 9.7.1.3 manual mode in manual mode, the pwm(s) are disabled immediately once a filtered fault condition is detected (logic high). the pwm(s) remain disabled until software clears the corresponding fflagx event bit and a new pwm cycle begins. in manual mode, the fault pins are grouped in pairs, each pair sharing common functionality. a fault condition on fault 1 may be cleared, allowing the pwm(s) to enable at the start of a pwm cycle regardless of the logic level at the fault pin. see figure 9-25 . a fault condition on fault 4 can be cleared, allowing the pwm(s) to enable, only if a logic low level at the fault pin is present at the start of a pwm cycle. see figure 9-26 . figure 9-25. pwm disabling in manual mode (example 1) figure 9-26. pwm disabling in manual mode (example 2) pwm(s) enabled pwm(s) enabled pwm(s) disabled fflagx cleared filtered fault pin 1 pwm(s) enabled pwm(s) enabled pwm(s) disabled fflagx cleared filtered fault pin 4 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 168 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control the function of the fault control and event bits is the same as in automatic mode except that the pwms are not re-enabled until the fflagx event bit is cleared by writing to the ftackx bit and the filtered fault condition is cleared (logic low). 9.7.2 software output disable setting pwm disable bit disx or disy in pwm control register 1 immediately disables the corresponding pwm pins as determined by the bank and disable mapping register. the pwm pin(s) remain disabled until the pwm disable bit is cleared and a new pwm cycle begins as shown in figure 9-27 . setting a pwm disable bit does not latch a cpu interrupt request, and there are no event flags associated with the pwm disable bits. 9.7.3 output port control when operating the pwms using the outx bits (outctl = 1), fault protection applies as described in this section. due to the absence of periodic pwm cycles, fault conditions are cleared upon each cpu cycle and the pwm outputs are re-enabled, provided all fault clearing conditions are satisfied. figure 9-27. pwm software disable pwm(s) enabled pwm(s) enabled pwm(s) disabled disable bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) initialization and the pwmen bit mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 169 9.8 initialization and the pwmen bit for proper operation, all registers should be initialized and the ldok bit should be set before enabling the pwm via the pwmen bit. when the pwmen bit is first set, a reload will occur immediately, setting the pwmf flag and generating an interrupt if pwmint is set. in addition, in complementary mode, pwm value registers 1, 3, and 5 will be used for the first pwm cycle if current sensing is selected. note: if the ldok bit is not set when pwmen is set after a reset , the prescaler and pwm values will be 0, but the modulus will be unknown. if the ldok bit is not set after the pwmen bit has been cleared then set (without a reset), the modulus value that was last loaded will be used. if the dead-time register (deadtm) is changed after pwmen or outctl is set, an improper dead-time insertion could occur. however, the dead-time can never be shorter than the specified value. because of the equals-comparator architecture of this pwm, the modulus = 0 case is considered illegal. therefore, the modulus register is not reset, and a modulus value of 0 will result in waveforms inconsistent with the other modulus waveforms. see 9.12.2 pwm counter modulo registers . when pwmen is set, the pwm pins change from high impedance to outputs. at this time, assuming no fault condition is present, the pwm pins will drive according to the pwm values, polarity, and dead-time. see the timing diagram in figure 9-28 . figure 9-28. pwmen and pwm pins cpu clock pwmen pwm pins drive according to pwm value, polarity, and dead-time hi-z if outctl = 0 hi-z if outctl = 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 170 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control when the pwmen bit is cleared, the following will occur:  pwm pins will be three-stated unless outctl = 1.  pwm counter is cleared and will not be clocked.  internally, the pwm generator will force its outputs to 0 to avoid glitches when the pwmen is set again. when pwmen is cleared, these features remain active:  all fault circuitry  manual pwm pin control via the pwmout register  dead-time insertion when pwm pins change via the pwmout register note: the pwmf flag and pending cpu interrupts are not cleared when pwmen = 0. 9.9 pwm operation in wait mode when the microcontroller is put in low-power wait mode via the wait instruction, all clocks to the pwm module will continue to run. if an interrupt is issued from the pwm module (via a reload or a fault), the microcontroller will exit wait mode. clearing the pwmen bit before entering wait mode will reduce power consumption in wait mode because the counter, prescaler divider, and ldfq divider will no longer be clocked. in addition, power will be reduced because the pwms will no longer toggle. 9.10 pwm operation in stop mode when the microcontroller is put in low-power wait mode via the stop instruction, all clocks to the pwm module will stop. note: it is imperative that the program to clear the pwmen bit before entering stop mode. leaving the pwm module enabled during stop mode can destroy power stages connected to the pwm outputs. the pwm generator will no longer be clocked during stop mode and the pwm outputs will no longer toggle. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) pwm operation in break mode mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 171 9.11 pwm operation in break mode if the microcontroller goes into break mode (or background mode), the clocks to the pwm generator and output control blocks will freeze. this allows the user to set a breakpoint on a development system and examine the register contents and pwm outputs at that point. it also allows the user to single-step through the code. the clocks to the fault block will continue to run. therefore, if a fault occurs while the microcontroller is in break mode, the pwm outputs will immediately be driven to their inactive state(s). during break mode, the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. refer to 7.7.5 sim break flag control register . to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the pwmf and fflagx bits during the break state, make sure bcfe is a logic 0. with bcfe at logic 0 (its default state), software can read and write the status and control registers during the break state without affecting the pwmf and fflagx bits. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 172 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.12 control logic block this subsection provides a description of the control logic block. 9.12.1 pwm counter registers the pwm counter registers (pcnth and pcntl) display the12-bit up/down or up-only counter. when the high byte of the counter is read, the lower byte is latched. pcntl will hold this latched value until it is read. ad- dress: $0026 bit 7654321bit 0 read: 0 0 0 0 bit11 bit 10 bit 9 bit 8 write: reset:00000000 = unimplemented figure 9-29. pwm counter register high (pcnth) ad- dress: $0027 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:00000000 = unimplemented figure 9-30. pwm counter register low (pcnth) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 173 9.12.2 pwm counter modulo registers the pwm counter modulus registers (pdmodh and pdmodl) hold a 12-bit unsigned number that determines the maximum count for the up/down or up-only counter. in center-aligned mode, the pwm period will be twice the modulus (assuming no prescaler). in edge-aligned mode, the pwm period will equal the modulus. to avoid erroneous pwm periods, this value is buffered and will not be used by the pwm generator until the ldok bit has been set and the next pwm load cycle begins. note: when reading this register, the value read is the buffer (not necessarily the value the pwm generator is currently using). because of the equals-comparator architecture of this pwm, the modulus = 0 case is considered illegal. therefore, the modulus register is not reset, and a modulus value of 0 will result in waveforms inconsistent with the other modulus waveforms. if a modulus of 0 is loaded, the counter will continually count down from $fff. this operation will not be tested or guaranteed. (the user should consider it ad- dress: $0028 bit 7654321bit 0 read: 0 0 0 0 bit 11 bit 10 bit 9 bit 8 write: reset:0000xxxx = unimplemented x = indeterminate figure 9-31. pwm counter modulo register high (pdmodh) ad- dress: $0029 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:xxxxxxxx = unimplemented x = indeterminate figure 9-32. pwm counter modulo register low (pdmodl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 174 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control illegal.) however, the dead-time constraints and fault conditions will still be guaranteed. 9.12.3 pwmx value registers each of the six pwms has a 16-bit pwm value register. the 16-bit signed value stored in this register determines the duty cycle of the pwm. the duty cycle is defined as: (pwm value/modulus) x 100. writing a number less than or equal to 0 causes the pwm to be off for the entire pwm period. writing a number greater than or equal to the 12-bit modulus causes the pwm to be on for the entire pwm period. if the complementary mode is selected, the pwm pairs share pwm value registers. to avoid erroneous pwm pulses, this value is buffered and will not be used by the pwm generator until the ldok bit has been set and the next pwm load cycle begins. note: when reading these registers, the value read is the buffer (not necessarily the value the pwm generator is currently using). bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset:00000000 figure 9-33. pwmx value registers high (pvalxh) bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:00000000 figure 9-34. pwmx value registers low (pvalxl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 175 9.12.4 pwm control register 1 pwm control register 1 controls pwm enabling/disabling, the loading of new modulus, prescaler, and pwm values, and the pwm correction method. in addition, this register contains the software disable bits to force the pwm outputs to their inactive states (according to the disable mapping register). disx ? software disable for bank x bit this read/write bit allows the user to disable one or more pwm pins in bank x. the pins that are disabled are determined by the disable mapping write-once register. 1 = disable pwm pins in bank x 0 = re-enable pwm pins at beginning of next pwm cycle disy ? software disable for bank y bit this read/write bit allows the user to disable one or more pwm pins in bank y. the pins that are disabled are determined by the disable mapping write-once register. 1 = disable pwm pins in bank y bit 0 = re-enable pwm pins at beginning of next pwm cycle pwmint ? pwm interrupt enable bit this read/write bit allows the user to enable and disable pwm cpu interrupts. if set, a cpu interrupt will be pending when the pwmf flag is set. 1 = enable pwm cpu interrupts 0 = disable pwm cpu interrupts ad- dress: $0020 bit 7 6 5 4 3 2 1 bit 0 read: disx disy pwmint pwmf ldok pw- men write: reset:00 0 00000 = unimplemented figure 9-35. pwm control register 1 (pctl1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 176 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control note: when pwmint is cleared, pending cpu interrupts are inhibited. pwmf ? pwm reload flag this read/write bit is set at the beginning of every reload cycle regardless of the state of the ldok bit. this bit is cleared by reading pwm control register 1 with the pwmf flag set, then writing a logic 0 to pwmf. if another reload occurs before the clearing sequence is complete, then writing logic 0 to pwmf has no effect. 1 = new reload cycle began. 0 = new reload cycle has not begun. note: when pwmf is cleared, pending pwm cpu interrupts are cleared (excluding fault interrupts). caution: bits 2 and/or 3 of pctl1 are reserved and must never be set to a 1. setting these bits to a 1 will affect the active pwm value registers. undesirable results will occur . ldok ? load ok bit this read/write bit allows the counter modulus, counter prescaler, and pwm values in the buffered registers to be used by the pwm generator. these values will not be used until the ldok bit is set and a new pwm load cycle begins. ldok may be cleared, if it is set, by writing a logic 0 to it prior to the beginning of a new pwm load cycle. internally this bit is automatically cleared after the new values are loaded. 1 = okay to load new modulus, prescaler, and pwm values at beginning of next pwm load cycle 0 = not okay to load new modulus, prescaler, and pwm values note: the user should initialize the pwm registers and set the ldok bit before enabling the pwm. pwmen ? pwm module enable bit this read/write bit enables and disables the pwm generator and the pwm pins. when pwmen is clear, the pwm generator is disabled and the pwm pins are in the high-impedance state (unless outctl = 1). when the pwmen bit is set, the pwm generator and pwm pins are activated. for more information, see 9.8 initialization and the pwmen bit . 1 = pwm generator and pwm pins enabled 0 = pwm generator and pwm pins disabled f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 177 note: a pwm cpu interrupt request can still be generated when ldok is 0. 9.12.5 pwm control register 2 pwm control register 2 controls the pwm load frequency, the pwm correction method, and the pwm counter prescaler. for ease of software and to avoid erroneous pwm periods, some of these register bits are buffered. the pwm generator will not use the prescaler value until the ldok bit has been set, and a new pwm cycle is starting. the correction bits are used at the beginning of each pwm cycle (if the isensx bits are configured for software correction). the load frequency bits are not used until the current load cycle is complete. note: the user should initialize this register before enabling the pwm. ldfq1 and ldfq0 ? pwm load frequency bits these buffered read/write bits select the pwm cpu load frequency according to table 9-5 . note: when reading these bits, the value read is the buffer value (not necessarily the value the pwm generator is currently using). ad- dress: $0021 bit 7654321bit 0 read: ldfq1 ldfq0 0 sel12 sel34 sel56 prsc1 prsc0 write: reset:00000000 = unimplement- ed bold = buffered figure 9-36. pwm control register 2 (pctl2) table 9-5. pwm reload frequency reload frequency bits ldfq1:ldfq0 pwm reload frequency 00 every pwm cycle 01 every 2 pwm cycles 10 every 4 pwm cycles 11 every 8 pwm cycles f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 178 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control sel12 ? top/bottom correction bit for pwm pair 1 (pwms 1 and 2) this buffered read/write bit selects which pwm value register is used for pwm pins 1 and 2 in complementary mode. 1 = use pwm value register 2. 0 = use pwm value register 1. note: when reading this bit, the value read is the buffer value (not necessarily the value the output control block is currently using). sel34 ? top/bottom correction bit for pwm pair 2 (pwms 3 and 4) this buffered read/write bit selects which pwm value register is used for pwm pins 3 and 4 in complementary mode. 1 = use pwm value register 4. 0 = use pwm value register 3. note: when reading this bit, the value read is the buffer value (not necessarily the value the output control block is currently using). sel56 ? top/bottom correction bit for pwm pair 3 (pwms 5 and 6) this buffered read/write bit selects which pwm value register is used for pwm pins 5 and 6 in complementary mode. 1 = use pwm value register 6. 0 = use pwm value register 5. note: when reading this bit, the value read is the buffer value (not necessarily the value the output control block is currently using). prsc1:prsc0 ? pwm prescaler bits these buffered read/write bits allow the pwm clock frequency to be modified as shown in table 9-6 . note: when reading these bits, the value read is the buffer value (not necessarily the value the pwm generator is currently using). table 9-6. pwm prescaler prescaler bits prsc1:prsc0 pwm clock frequency 00 f op 01 f op /2 10 f op /4 11 f op /8 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 179 note: if prsc1 and prsc2 are set to any value other than 0, there is a one pwm cycle latency time before the pwm pins are driven after the pwmen bit is set. 9.12.6 dead-time write-once register the dead-time write-once register (deadtm) holds an 8-bit value which specifies the number of cpu clock cycles to use for the dead-time when complementary pwm mode is selected. after this register is written for the first time, it cannot be rewritten unless a reset occurs. the dead-time is not affected by changes to the prescaler value. 9.12.7 pwm disable mapping write-once register the pwm disable mapping write-once register (dismap) holds an 8-bit value which determines which pwm pins will be disabled if an external fault or software disable occur. for a further description of the disable mapping, see 9.7 fault protection . after this register is written for the first time, it cannot be rewritten unless a reset occurs. ad- dress: $0036 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:11111111 figure 9-37. dead-time write-once register (deadtm) ad- dress: $0037 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:11111111 figure 9-38. pwm disable mapping write-once register (dismap) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 180 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.12.8 fault control register this register controls the fault protection circuitry. fmode1 ? fault mode selection for fault pin 1 bit (automatic versus manual mode) this read/write bit allows the user to select between automatic and manual mode faults. for further description of each mode, see 9.7 fault protection . 1 = automatic mode 0 = manual mode fint1 ? fault 1 interrupt enable bit this read/write bit allows the cpu interrupt caused by faults on fault pin 1 to be enabled. the fault protection circuitry is independent of this bit and will always be active. if a fault is detected, the pwm pins will still be disabled according to the disable mapping register. 1 = fault pin 1 will cause cpu interrupts. 0 = fault pin 1 will not cause cpu interrupts. fmode4 ? fault mode selection for fault pin 4 bit (automatic versus manual mode) this read/write bit allows the user to select between automatic and manual mode faults. for further description of each mode, see 9.7 fault protection . 1 = automatic mode 0 = manual mode ad- dress: $0022 bit 7654321bit 0 read: fint4 fmode 4 fint1 fmode 1 write: reset:00000000 = unimplemented figure 9-39. fault control register (fcr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 181 fint4 ? fault 4 interrupt enable bit this read/write bit allows the cpu interrupt caused by faults on fault pin 4 to be enabled. the fault protection circuitry is independent of this bit and will always be active. if a fault is detected, the pwm pins will still be disabled according to the disable mapping register. 1 = fault pin 4 will cause cpu interrupts. 0 = fault pin 4 will not cause cpu interrupts. 9.12.9 fault status register this read-only register indicates the current fault status. fflag1 ? fault event flag 1 the fflag1 event bit is set within two cpu cycles after a rising edge on fault pin 1. to clear the fflag1 bit, the user must write a 1 to the ftack1 bit in the fault acknowledge register. 1 = a fault has occurred on fault pin 1 0 = no new fault on fault pin 1 fpin1 ? state of fault pin 1 this read-only bit allows the user to read the current state of fault pin 1. 1 = fault pin 1 is at logic 1 0 = fault pin 1 is at logic 0 ad- dress: $0023 bit 7654321bit 0 read: fpin4 fflag 4 0000fpin1 fflag 1 write: reset:u0u0u0u0 = unimplement- ed u = unaffected figure 9-40. fault status register (fsr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 182 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control fflag4 ? fault event flag 4 the fflag4 event bit is set within two cpu cycles after a rising edge on fault pin 4. to clear the fflag4 bit, the user must write a 1 to the ftack4 bit in the fault acknowledge register. 1 = a fault has occurred on fault pin 4 0 = no new fault on fault pin 4 fpin4 ? state of fault pin 4 bit this read-only bit allows the user to read the current state of fault pin 4. 1 = fault pin 4 is at logic 1. 0 = fault pin 4 is at logic 0. 9.12.10 fault acknowledge register the fault acknowledge register (ftack) is used to acknowledge and clear the fflags. in addition, it is used to monitor the current sensing bits to test proper operation. ad- dress: $0024 bit 7654321bit 0 read:00000000 write: ftack 4 ftack 1 reset:00000000 = unimplement- ed figure 9-41. fault acknowledge register (ftack) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) control logic block mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 183 ftack1 ? fault acknowledge 1 bit the ftack1 bit is used to acknowledge and clear fflag1. this bit will always read 0. writing a 1 to this bit will clear fflag1. writing a 0 will have no effect. ftack4 ? fault acknowledge 4 bit the ftack4 bit is used to acknowledge and clear fflag4. this bit will always read 0. writing a 1 to this bit will clear fflag4. writing a 0 will have no effect. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 184 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control 9.12.11 pwm output control register this register is used to manually control the pwm pins. outctl ? output control enable this read/write bit allows the user to manually control the pwm pins. when set, the pwm generator is no longer the input to the dead-time and output circuitry. the outx bits determine the state of the pwm pins. setting the outctl bit does not disable the pwm generator. the generator continues to run, but is no longer the input to the pwm dead-time and output circuitry. when outctl is cleared, the outputs of the pwm generator immediately become the inputs to the dead-time and output circuitry. 1 = pwm outputs controlled manually 0 = pwm outputs determined by pwm generator ad- dress: $0025 bit 7654321bit 0 read: 0 out- ctl out6 out5 out4 out3 out2 out1 write: reset:00000000 = unimplement- ed u = unaffected figure 9-42. pwm output control register (pwmout) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse-width modulator for motor control (pwmmc) pwm glossary mc68hc908mr8 ? rev 4.0 technical data motorola pulse-width modulator for motor control (pwmmc) 185 out6:out1 ? pwm pin output control bits these read/write bits control the pwm pins according to table 9-7 . 9.13 pwm glossary cpu cycle ? one internal bus cycle (1/f op ) pwm clock cycle (or period) ? one tick of the pwm counter (1/f op with no prescaler). see figure 9-43 . pwm cycle (or period)  center-aligned mode: the time it takes the pwm counter to count up and count down (modulus * 2/f op assuming no prescaler). see figure 9-43 .  edge-aligned mode: the time it takes the pwm counter to count up (modulus/f op ). see figure 9-43 . table 9-7. outx bits outx bit complementary mode independent mode out1 1 ? pwm1 is active 0 ? pwm1 is inactive 1 ? pwm1 is active 0 ? pwm1 is inactive out2 1 ? pwm2 is complement of pwm 1 0 ? pwm2 is inactive 1 ? pwm2 is active 0 ? pwm2 is inactive out3 1 ? pwm3 is active 0 ? pwm3 is inactive 1 ? pwm3 is active 0 ? pwm3 is inactive out4 1 ? pwm4 is complement of pwm 3 0 ? pwm4 is inactive 1 ? pwm4 is active 0 ? pwm4 is inactive out5 1 ? pwm5 is active 0 ? pwm5 is inactive 1 ? pwm5 is active 0 ? pwm5 is inactive out6 1 ? pwm 6 is complement of pwm 5 0 ? pwm6 is inactive 1 ? pwm6 is active 0 ? pwm6 is inactive f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 186 pulse-width modulator for motor control (pwmmc) motorola pulse-width modulator for motor control figure 9-43. pwm clock cycle and pwm cycle definitions pwm load frequency ? the frequency at which new pwm parameters get loaded into the pwm. see figure 9-44 . figure 9-44. pwm load cycle/frequency definition pwm clock cycle pwm cycle (or period) pwm pwm cycle (or period) center-aligned mode edge-aligned mode clock cycle reload new modulus, prescaler, and pwm values if ldok = 1 reload new modulus, prescaler, and pwm values if ldok = 1 pwm load cycle ldfq1:ldfq0 = 01 ? reload every two cycles (1/pwm load frequency) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 187 technical data ? mc68hc908mr8 section 10. monitor rom (mon) 10.1 contents 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10.4.1 entering monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10.4.2 forced monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 10.4.3 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 10.4.4 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 10.4.5 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10.4.6 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10.4.7 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 10.5 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 10.2 introduction this section describes the monitor read-only memory (rom). the monitor rom (mon) allows complete testing of the microcontroller unit (mcu) through a 2-wire interface with a host computer. 10.3 features features of the monitor rom include:  normal user-mode pin functionality  standard mark/space non-return-to-zero (nrz) communication with host computer  9600 baud communication with host computer  execution of code in random-access memory (ram) or rom f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 188 monitor rom (mon) motorola monitor rom (mon) 10.4 functional description the monitor rom receives and executes commands from a host computer. figure 10-1 shows a sample circuit used to enter monitor mode and communicate with a host computer via a standard rs-232 interface. simple monitor commands can access any memory address. in monitor mode, the mcu can execute host-computer code in ram while all mcu pins retain normal operating mode functions. all communication between the host computer and the mcu is through the serial communications interface (sci). a level-shifting rs-232 interface is required between the sci and the host computer. ptb1 requires a pulldown resistor to ensure proper entry into monitor mode. 10.4.1 entering monitor mode table 10-1 shows the pin conditions for entering monitor mode. table 10-1. mode selection irq pin reset $fffe/ $ffff pll ptb0 ptb1 external clock cgmout f op cop baud rate comment x v ss x x x x x 0 0 disabled 0 no operation until reset = v dd v hi v dd or v hi xon v dd v ss 4.0 mhz 16.0 mhz 8.0 mhz disabled 9600 pll configured with bcs set by monitor code v dd v dd blank (ff) on x x 4.0 mhz 16.0 mhz 8.0 mhz disabled 9600 pll configured with bcs set by monitor code v ss v dd blank (ff) off x x f osc f osc /2 f osc /4 disabled f osc /1024 enters monitor mode with any external clock rate within operating spec v dd v dd non-blank x x x x x x enabled x enters user mode x = don ? t care ptb0 = v dd and ptb1 = v ss to enter monitor mode ptb0 (rxd) and ptb1 (txd) used for serial communications (all monitor mode) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
monitor rom (mon) functional description mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 189 figure 10-1. monitor mode circuit + + + + 10 m ? x1 v dd v hi mc145407 rst irq cgmxfc osc1 osc2 v ss v dd 0.1 f 0.02 f 10 k ? 6 5 2 4 3 1 db-25 2 3 7 20 18 17 19 16 15 v dd v dd 20 pf 20 pf 10 f 10 f 10 f 10 f 0.1 f 4.00 mhz 10 k ? v dda 0.1 f v dda v refh 0.1 f v refh ptb1/txd ptb0/rxd 10 k ? v ssa mc68hc908mr8 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 190 monitor rom (mon) motorola monitor rom (mon) enter monitor mode by applying a logic 0 and then a logic 1 to the rst pin (see table 10-1 ) once out of reset, the mcu waits for the host to send eight security bytes. after receiving the security bytes, the mcu sends a break signal (10 consecutive logic 0s) to the host computer, indicating that it is ready to receive a command. monitor mode uses alternate vectors for reset and swi. the alternate vectors are in the $fe page instead of the $ff page and allow code execution from the internal monitor firmware instead of user code. the computer operating properly (cop) module is disabled in monitor mode as long as v hi is applied to either the irq pin or the rst pin. refer to section 7. system integration module (sim) for more information on modes of operation. 10.4.2 forced monitor mode on flash parts, if the voltage applied to the irq1 is less than v hi , the mcu will come out of reset in user mode. the memory reset module monitors the reset vector fetches and will assert an internal reset if it detects that the reset vectors are erased. when the mcu comes out of reset with its reset vector erased, it is forced into monitor mode without requiring high voltage on the irq1 pin. the computer operating properly (cop) module is disabled in forced monitor mode. any reset other than a power-on reset (por) will automatically force the mcu to come back to the forced monitor mode. table 10-2 is a summary of the differences between user mode and monitor mode. table 10-2. mode differences modes functions cop reset vector high reset vector low swi vector high swi vector low user enabled $fffe $ffff $fffc $fffd monitor disabled (1) 1. if the high voltage (v hi ) is removed from the irq pin or the rst pin, the sim asserts its cop enable output. $fefe $feff $fefc $fefd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
monitor rom (mon) functional description mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 191 10.4.3 baud rate with a 4.0-mhz reference clock source, data is transferred between the monitor and host at 9600 baud. the communication baud rate is achieved by stepping up the internal cpu frequency to 8 mhz, using the phase-locked loop (pll). a 4.0-mhz reference frequency is necessary in this mode as the pll will not lock with any other reference clock. as described in table 10-1 , on flash parts when v ss is applied to irq with $fffe and $ffff = 0, the pll setup is bypassed and the baud rate is equal to the reference frequency divided by 1024. this facilitates a faster communication rate in the interest of a first time programmed device. this allows selection of other reference frequencies and thus, facilities a faster communication rate. the reference frequency, in this case while not utilizing the pll, is limited to the range of f op . refer to 21.8 control timing . 10.4.4 data format communication with the monitor rom is in standard non-return-to-zero (nrz) mark/space data format. see figure 10-2 and figure 10-3 . figure 10-2. monitor data format figure 10-3. sample monitor waveforms the data transmit and receive rate is 9600 baud. transmit and receive baud rates will be identical. bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 start bit bit 0 bit 1 next stop bit start bit bit 2 $a5 break bit 3 bit 4 bit 5 bit 6 bit 7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 192 monitor rom (mon) motorola monitor rom (mon) 10.4.5 echoing as shown in figure 10-4 , the monitor rom immediately echoes each received byte back to the ptb1/txd pin for error checking. figure 10-4. read transaction any result of a command appears after the echo of the last byte of the command. 10.4.6 break signal a start bit, followed by nine low bits, is a break signal. see figure 10-5 . when the monitor receives a break signal, it delays two bit times before echoing the break signal. figure 10-5. break transaction addr. high read read addr. high addr. low addr. low data echo sent to monitor result 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 missing stop bit two-stop-bit delay before zero echo f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
monitor rom (mon) functional description mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 193 10.4.7 commands the monitor rom uses these commands:  read, read memory  write, write memory  iread, indexed read  iwrite, indexed write  readsp, read stack pointer  run, run user program refer to table 10-3 through table 10-8 . table 10-3. read (read memory) command description read byte from memory operand specifies 2-byte address in high byte:low byte order data returned returns contents of specified address opcode $4a command sequence addr. high read read addr. high addr. low addr. low data echo sent to monitor result table 10-4. write (write memory) command description write byte to memory operand specifies 2-byte address in high byte:low byte order; low byte followed by data byte data returned none opcode $49 command sequence addr. high write write addr. high addr. low addr. low data echo sent to monitor data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 194 monitor rom (mon) motorola monitor rom (mon) note: a sequence of iread or iwrite commands can sequentially access a block of memory over the full 64-kbyte memory map. table 10-5. iread (indexed read) command description read next 2 bytes in memory from last address accessed operand specifies 2-byte address in high byte:low byte order data returned returns contents of next two addresses opcode $1a command sequence table 10-6. iwrite (indexed write) command description write to last address accessed + 1 operand specifies single data byte data returned none opcode $19 command sequence data iread iread data echo sent to monitor result data iwrite iwrite data echo sent to monitor f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
monitor rom (mon) functional description mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 195 table 10-7. readsp (read stack pointer) command description reads stack pointer operand none data returned returns stack pointer in high byte:low byte order opcode $0c command sequence table 10-8. run (run user program) command description executes rti instruction operand none data returned none opcode $28 command sequence sp high readsp readsp sp low echo sent to monitor result run run echo sent to monitor f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 196 monitor rom (mon) motorola monitor rom (mon) 10.5 security a security feature discourages unauthorized reading of rom locations while in monitor mode. the host can satisfy the security feature at monitor mode entry by sending eight security bytes that match the bytes at locations $fff6 ? $fffd. locations $fff6 ? $fffd contain user-defined data. note: do not leave locations $fff6 ? $fffd blank. for security reasons, program locations $fff6 ? $fffd even if they are not used for vectors. during monitor mode entry, the mcu waits after the power-on reset for the host to send the eight security bytes on pin ptb0 (r x d). if the received bytes match those at locations $fff6 ? $fffd, the host satisfies the security feature and can read all rom locations and execute code from rom. security remains satisfied until a power-on reset occurs. if the reset was not a power-on reset, security remains satisfied and security code entry is not required. see figure 10-6 . figure 10-6. monitor mode entry timing byte 1 byte 1 echo byte 2 byte 2 echo byte 8 byte 8 echo command command echo pa0 pa7 rst v dd 4096 + 32 cgmxclk cycles 24 bus cycles 256 bus cycles (minimum) 1 4 1 1 2 1 break notes: 2 = data return delay, 2 bit times 4 = wait 1 bit time before sending next byte. 4 from host from mcu 1 = echo delay, 2 bit times f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
monitor rom (mon) security mc68hc908mr8 ? rev 4.0 technical data motorola monitor rom (mon) 197 upon power-on reset, if the received bytes of the security code do not match the data at locations $fff6 ? $fffd, the host fails to satisfy the security feature. the mcu remains in monitor mode, but reading a rom location returns an invalid value and trying to execute code from rom causes an illegal address reset. after receiving the eight security bytes from the host, the mcu transmits a break character, signifying that it is ready to receive a command. note: the mcu does not transmit a break character until after the host sends the eight security bytes. to determine whether the security code entered is correct, check to see if bit 6 of ram address $60 is set. if it is, then the correct security code has been entered and rom can be accessed. if the security sequence fails, the device can be reset (via power-pin reset only) and brought up in monitor mode to attempt another entry. after failing the security sequence, the flash memory can also be bulk erased by executing an erase routine that was downloaded into internal ram. the bulk erase operation clears the security code locations so that all eight security bytes become $ff. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 198 monitor rom (mon) motorola monitor rom (mon) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 199 technical data ? mc68hc908mr8 section 11. timer interface a (tima) 11.1 contents 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 11.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 11.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 11.4.1 tima counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . 204 11.4.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 11.4.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 11.4.4 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . 207 11.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 11.6 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 11.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 11.8 tima during break interrupts . . . . . . . . . . . . . . . . . . . . . . . 212 11.9 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 11.9.1 tima clock pin (ptb2/tclka) . . . . . . . . . . . . . . . . . . . . 213 11.9.2 tima channel i/o pins (ptb3/tch0a ? ptb4/tch1a) . . 213 11.10 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 11.10.1 tima status and control register . . . . . . . . . . . . . . . . . 214 11.10.2 tima counter registers . . . . . . . . . . . . . . . . . . . . . . . . . 216 11.10.3 tima counter modulo registers . . . . . . . . . . . . . . . . . . . 217 11.10.4 tima channel status and control registers . . . . . . . . . 218 11.10.5 tima channel registers . . . . . . . . . . . . . . . . . . . . . . . . . 222 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 200 timer interface a (tima) motorola timer interface a (tima) 11.2 introduction this section describes the timer interface module (tima). the tima is a 2-channel timer that provides:  timing reference with input capture  output compare  pulse-width modulation (pwm) functions refer to figure 11-1 for a block diagram of the tima and to figure 11-2 for a summary of the registers. for further information regarding timers on m68hc08 family devices, please consult the hc08 timer reference manual, tim08rm/ad. 11.3 features features of the tima include:  two input capture/output compare channels: ? rising-edge, falling-edge, or any-edge input capture trigger ? set, clear, or toggle output compare action  buffered and unbuffered pulse-width modulation (pwm) signal generation  programmable tima clock input: ? 7-frequency internal bus clock prescaler selection ? external tima clock input (4-mhz maximum frequency)  free-running or modulo up-count operation  toggle any channel pin on overflow  tima counter stop and reset bits f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) features mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 201 figure 11-1. tima block diagram prescaler prescaler select tclk 16-bit comparator ps2 ps1 ps0 16-bit comparator 16-bit latch tch0h:tch0l ms0a els0b els0a tof toie channel 0 tmodh:tmodl trst tstop tov0 ch0ie ch0f ch0max ms0b 16-bit counter internal bus clock ptb2/tclka ptb3/tch0a ptb4/tch1a 16-bit comparator 16-bit latch tch1h:tch1l ms1a els1b els1a channel 1 tov1 ch1ie ch1f ch1max interrupt logic ptb3 logic ptb4 logic interrupt logic interrupt logic addr. register name bit 7 6 5 4 3 2 1 bit 0 $000 e tima status/control regis- ter (tasc) see page 214. read : tof toie tstop 00 ps2 ps1 ps0 write : 0trstr re- set: 00100000 $000 f tima counter register high (tacnth) see page 216. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : rrrrrrrr re- set: 00000000 r= reserved figure 11-2. tima i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 202 timer interface a (tima) motorola timer interface a (tima) $0010 tima counter register low (tacntl) see page 216. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : rrrrrrrr re- set: 00000000 $0011 tima counter modulo reg- ister high (tamodh) see page 217. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: 11111111 $0012 tima counter modulo reg- ister low (tamodl) see page 217. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: 11111111 $0013 tima channel 0 sta- tus/control register (tasc0) see page 218. read : ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0ma x write : 0 re- set: 00000000 $0014 tima channel 0 register high (tach0h) see page 222. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: indeterminate after reset $0015 tima channel 0 register low (tach0l) see page 218. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: indeterminate after reset addr. register name bit 7 6 5 4 3 2 1 bit 0 r= reserved figure 11-2. tima i/o register summary (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) features mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 203 $0016 tima channel 1 sta- tus/control register (tasc1) see page 218. read : ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write : 0r re- set: 00000000 $0017 tima channel 1 register high (tach1h) see page 222. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: indeterminate after reset $0018 tima channel 1 register low (tach1l) see page 222. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: indeterminate after reset addr. register name bit 7 6 5 4 3 2 1 bit 0 r= reserved figure 11-2. tima i/o register summary (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 204 timer interface a (tima) motorola timer interface a (tima) 11.4 functional description figure 11-1 shows the tima structure. the central component of the tima is the 16-bit tima counter that can operate as a free-running counter or a modulo up-counter. the tima counter provides the timing reference for the input capture and output compare functions. the tima counter modulo registers, tamodh ? tamodl, control the modulo value of the tima counter. software can read the tima counter value at any time without affecting the counting sequence. the two tima channels are programmable independently as input capture or output compare channels. 11.4.1 tima counter prescaler the tima clock source can be one of the seven prescaler outputs or the tima clock pin, ptb2/tclka. the prescaler generates seven clock rates from the internal bus clock. the prescaler select bits, ps[2:0], in the tima status and control register select the tima clock source. 11.4.2 input capture an input capture function has three basic parts: 1. edge select logic 2. input capture latch 3. 16-bit counter two 8-bit registers, which make up the 16-bit input capture register, are used to latch the value of the free-running counter after the corresponding input capture edge detector senses a defined transition. the polarity of the active edge is programmable. the level transition which triggers the counter transfer is defined by the corresponding input edge bits (elsxb and elsxa in the tasc0 and tasc1 control registers with x referring to the active channel number). when an active edge occurs on the pin of an input capture channel, the tima latches the contents of the tima counter into the tima channel registers, tchxh ? tchxl. input captures can generate tima cpu interrupt requests. software can determine that an input capture event f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 205 has occurred by enabling input capture interrupts or by polling the status flag bit. the free-running counter contents are transferred to the tima channel status and control registers tachxh and tachxl (see 11.10.5 tima channel registers ) on each proper signal transition regardless of whether the tima channel flag (ch0f ? ch1f in the tasc0 ? tasc1 registers) is set or clear. when the status flag is set, a cpu interrupt is generated if enabled. the value of the count latched or captured is the time of the event. because this value is stored in the input capture register two bus cycles after the actual event occurs, user software can respond to this event at a later time and determine the actual time of the event. however, this must be done prior to another input capture on the same pin; otherwise, the previous time value will be lost. by recording the times for successive edges on an incoming signal, software can determine the period and/or pulse width of the signal. to measure a period, two successive edges of the same polarity are captured. to measure a pulse width, two alternate polarity edges are captured. software should track the overflows at the 16-bit module counter to extend its range. another use for the input capture function is to establish a time reference. in this case, an input capture function is used in conjunction with an output compare function. for example, to activate an output signal a specified number of clock cycles after detecting an input event (edge), use the input capture function to record the time at which the edge occurred. a number corresponding to the desired delay is added to this captured value and stored to an output compare register (see 11.10.5 tima channel registers ). because both input captures and output compares are referenced to the same 16-bit modulo counter, the delay can be controlled to the resolution of the counter independent of software latencies. note: reset does not affect the contents of the input capture channel register (tachxh ? tachxl). 11.4.3 output compare with the output compare function, the tima can generate a periodic pulse with a programmable polarity, duration, and frequency. when the f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 206 timer interface a (tima) motorola timer interface a (tima) counter reaches the value in the registers of an output compare channel, the tima can set, clear, or toggle the channel pin. output compares can generate tima cpu interrupt requests. 11.4.3.1 unbuffered output compare any output compare channel can generate unbuffered output compare pulses as described in 11.4.3 output compare . the pulses are unbuffered because changing the output compare value requires writing the new value over the old value currently in the tima channel registers. an unsynchronized write to the tima channel registers to change an output compare value could cause incorrect operation for up to two counter overflow periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that counter overflow period. also, using a tima overflow interrupt routine to write a new, smaller output compare value may cause the compare to be missed. the tima may pass the new value before it is written. use these methods to synchronize unbuffered changes in the output compare value on channel x:  when changing to a smaller value, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current output compare pulse. the interrupt routine has until the end of the counter overflow period to write the new value.  when changing to a larger output compare value, enable tima overflow interrupts and write the new value in the tima overflow interrupt routine. the tima overflow interrupt occurs at the end of the current counter overflow period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same counter overflow period. 11.4.3.2 buffered output compare channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the ptb3/tch0a pin. the tima channel registers of the linked pair alternately control the output. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 207 setting the ms0b bit in tima channel 0 status and control register (tasc0) links channel 0 and channel 1. the output compare value in the tima channel 0 registers initially controls the output on the ptb3/tch0a pin. writing to the tima channel 1 registers enables the tima channel 1 registers to synchronously control the output after the tima overflows. at each subsequent overflow, the tima channel registers (0 or 1) that control the output are the ones written to last. tsc0 controls and monitors the buffered output compare function, and tima channel 1 status and control register (tasc1) is unused. while the ms0b bit is set, the channel 1 pin, ptb4/tch1a, is available as a general-purpose input/output (i/o) pin. note: in buffered output compare operation, do not write new output compare values to the currently active channel registers. user software should track the currently active channel to prevent writing a new value to the active channel. writing to the active channel registers is the same as generating unbuffered output compares. 11.4.4 pulse-width modulation (pwm) by using the toggle-on-overflow feature with an output compare channel, the tima can generate a pwm signal. the value in the tima counter modulo registers determines the period of the pwm signal. the channel pin toggles when the counter reaches the value in the tima counter modulo registers. the time between overflows is the period of the pwm signal. as figure 11-3 shows, the output compare value in the tima channel registers determines the pulse width of the pwm signal. the time between overflow and output compare is the pulse width. program the tima to clear the channel pin on output compare if the state of the pwm pulse is logic 1. program the tima to set the pin if the state of the pwm pulse is logic 0. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 208 timer interface a (tima) motorola timer interface a (tima) figure 11-3. pwm period and pulse width the value in the tima counter modulo registers and the selected prescaler output determines the frequency of the pwm output. the frequency of an 8-bit pwm signal is variable in 256 increments. writing $00ff (255) to the tima counter modulo registers produces a pwm period of 256 times the internal bus clock period if the prescaler select value is $000. see 11.10.1 tima status and control register . the value in the tima channel registers determines the pulse width of the pwm output. the pulse width of an 8-bit pwm signal is variable in 256 increments. writing $0080 (128) to the tima channel registers produces a duty cycle of 128/256 or 50 percent. 11.4.4.1 unbuffered pwm signal generation any output compare channel can generate unbuffered pwm pulses as described in 11.4.4 pulse-width modulation (pwm) . the pulses are unbuffered because changing the pulse width requires writing the new pulse width value over the value currently in the tima channel registers. an unsynchronized write to the tima channel registers to change a pulse width value could cause incorrect operation for up to two pwm periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that pwm period. also, using a tima overflow interrupt routine to write a new, smaller pulse width value may cause the compare to be missed. the tima may pass the new value before it is written to the tima channel registers. ptbx/tchx period pulse width overflow overflow overflow output compare output compare output compare f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 209 use these methods to synchronize unbuffered changes in the pwm pulse width on channel x:  when changing to a shorter pulse width, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current pulse. the interrupt routine has until the end of the pwm period to write the new value.  when changing to a longer pulse width, enable tima overflow interrupts and write the new value in the tima overflow interrupt routine. the tima overflow interrupt occurs at the end of the current pwm period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same pwm period. note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare also can cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 11.4.4.2 buffered pwm signal generation channels 0 and 1 can be linked to form a buffered pwm channel whose output appears on the ptb3/tch0a pin. the tima channel registers of the linked pair alternately control the pulse width of the output. setting the ms0b bit in tima channel 0 status and control register (tasc0) links channel 0 and channel 1. the tima channel 0 registers initially control the pulse width on the ptb3/tch0a pin. writing to the tima channel 1 registers enables the tima channel 1 registers to synchronously control the pulse width at the beginning of the next pwm period. at each subsequent overflow, the tima channel registers (0 or 1) that control the pulse width are the ones written to last. tasc0 controls and monitors the buffered pwm function, and tima channel 1 status and control register (tasc1) is unused. while the ms0b bit is set, the channel 1 pin, ptb4/tch1a, is available as a general-purpose i/o pin. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 210 timer interface a (tima) motorola timer interface a (tima) note: in buffered pwm signal generation, do not write new pulse width values to the currently active channel registers. user software should track the currently active channel to prevent writing a new value to the active channel. writing to the active channel registers is the same as generating unbuffered pwm signals. 11.4.4.3 pwm initialization to ensure correct operation when generating unbuffered or buffered pwm signals, use this initialization procedure: 1. in the tima status and control register (tasc): a. stop the tima counter by setting the tima stop bit, tstop. b. reset the tima counter and prescaler by setting the tima reset bit, trst. 2. in the tima counter modulo registers (tamodh ? tamodl), write the value for the required pwm period. 3. in the tima channel x registers (tachxh ? tachxl), write the value for the required pulse width. 4. in tima channel x status and control register (tascx): a. write 0:1 (for unbuffered output compare or pwm signals) or 1:0 (for buffered output compare or pwm signals) to the mode select bits, msxb ? msxa. see table 11-2 . b. write 1 to the toggle-on-overflow bit, tovx. c. write 1:0 (to clear output on compare) or 1:1 (to set output on compare) to the edge/level select bits, elsxb ? elsxa. the output action on compare must force the output to the complement of the pulse width level. see table 11-2 . note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare can also cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 5. in the tima status control register (tasc), clear the tima stop bit, tstop. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) interrupts mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 211 setting ms0b links channels 0 and 1 and configures them for buffered pwm operation. the tima channel 0 registers (tach0h ? tach0l) initially control the buffered pwm output. tima status control register 0 (tasc0) controls and monitors the pwm signal from the linked channels. ms0b takes priority over ms0a. clearing the toggle-on-overflow bit, tovx, inhibits output toggles on tima overflows. subsequent output compares try to force the output to a state it is already in and have no effect. the result is a 0 percent duty cycle output. setting the channel x maximum duty cycle bit (chxmax) and setting the tovx bit generates a 100 percent duty cycle output. see 11.10.4 tima channel status and control registers . 11.5 interrupts these tima sources can generate interrupt requests:  tima overflow flag (tof) ? the tof bit is set when the tima counter reaches the modulo value programmed in the tima counter modulo registers. the tima overflow interrupt enable bit, toie, enables tima overflow cpu interrupt requests. tof and toie are in the tima status and control register.  tima channel flags (ch1f ? ch0f) ? the chxf bit is set when an input capture or output compare occurs on channel x. channel x tima cpu interrupt requests are controlled by the channel x interrupt enable bit, chxie. 11.6 wait mode the wait instruction puts the mcu in low-power standby mode. the tima remains active after the execution of a wait instruction. in wait mode, the tima registers are not accessible by the cpu. any enabled cpu interrupt request from the tima can bring the mcu out of wait mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 212 timer interface a (tima) motorola timer interface a (tima) if tima functions are not required during wait mode, reduce power consumption by stopping the tima before executing the wait instruction. 11.7 stop mode tima is inactive after execution of a stop instruction. the stop instruction does not affect register conditions or the state of the tima counter. tima operation resumes when the mcu exits stop mode after an external interrupt. 11.8 tima during break interrupts a break interrupt stops the tima counter and inhibits input captures. the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. see 7.7.5 sim break flag control register . to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. 11.9 i/o signals port b shares three of its pins with the tima. ptb2/tclka is an external clock input to the tima prescaler. the two tima channel i/o pins are ptb3/tch0a and ptb4/tch1a. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 213 11.9.1 tima clock pin (ptb2/tclka) ptb2/tclka is an external clock input that can be the clock source for the tima counter instead of the prescaled internal bus clock. select the ptb2/tclka input by writing logic 1s to the three prescaler select bits, ps[2:0] (see 11.10.1 tima status and control register ). the minimum tclk pulse width, tclklmin or tclkhmin, is: the maximum tclk frequency is the least: 4 mhz or bus frequency ? ptb4/tch1a) each channel i/o pin is programmable independently as an input capture pin or an output compare pin. ptb3/tch0a and ptb3/tch1a can be configured as buffered output compare or buffered pwm pins. 11.10 i/o registers these i/o registers control and monitor tima operation:  tima status and control register (tasc)  tima control registers (tacnth ? tacntl)  tima counter modulo registers (tamodh ? tamodl)  tima channel status and control registers (tasc0 and tasc1)  tima channel registers (tach0h ? tach0l and tach1h ? tach1l) 1 bus frequency ------------------------------------- t su + f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 214 timer interface a (tima) motorola timer interface a (tima) 11.10.1 tima status and control register the tima status and control register:  enables tima overflow interrupts  flags tima overflows  stops the tima counter  resets the tima counter  prescales the tima counter clock tof ? tima overflow flag bit this read/write flag is set when the tima counter reaches the modulo value programmed in the tima counter modulo registers. clear tof by reading the tima status and control register when tof is set and then writing a logic 0 to tof. if another tima overflow occurs before the clearing sequence is complete, then writing logic 0 to tof has no effect. therefore, a tof interrupt request cannot be lost due to inadvertent clearing of tof. reset clears the tof bit. writing a logic 1 to tof has no effect. 1 = tima counter has reached modulo value. 0 = tima counter has not reached modulo value. toie ? tima overflow interrupt enable bit this read/write bit enables tima overflow interrupts when the tof bit becomes set. reset clears the toie bit. 1 = tima overflow interrupts enabled 0 = tima overflow interrupts disabled address : $000e bit 7654321bit 0 read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst r reset:00100000 r= reserved figure 11-4. tima status and control register (tasc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 215 tstop ? tima stop bit this read/write bit stops the tima counter. counting resumes when tstop is cleared. reset sets the tstop bit, stopping the tima counter until software clears the tstop bit. 1 = tima counter stopped 0 = tima counter active note: do not set the tstop bit before entering wait mode if the tima is required to exit wait mode. also, when the tstop bit is set and the timer is configured for input capture operation, input captures are inhibited until tstop is cleared. trst ? tima reset bit setting this write-only bit resets the tima counter and the tima prescaler. setting trst has no effect on any other registers. counting resumes from $0000. trst is cleared automatically after the tima counter is reset and always reads as logic 0. reset clears the trst bit. 1 = prescaler and tima counter cleared 0 = no effect note: setting the tstop and trst bits simultaneously stops the tima counter at a value of $0000. ps[2:0] ? prescaler select bits these read/write bits select either the ptb2/tclka pin or one of the seven prescaler outputs as the input to the tima counter as table 11-1 shows. reset clears the ps[2:0] bits. table 11-1. prescaler selection ps[2:0] tima clock source 000 internal bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 216 timer interface a (tima) motorola timer interface a (tima) 11.10.2 tima counter registers the two read-only tima counter registers contain the high and low bytes of the value in the tima counter. reading the high byte (tacnth) latches the contents of the low byte (tacntl) into a buffer. subsequent reads of tacnth do not affect the latched tacntl value until tacntl is read. reset clears the tima counter registers. setting the tima reset bit (trst) also clears the tima counter registers. note: if tacnth is read during a break interrupt, be sure to unlatch tacntl by reading tacntl before exiting the break interrupt. otherwise, tacntl retains the value latched during the break. register name and ad- dress: tacnth ? $000f bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write:rrrrrrrr reset:00000000 register name and ad- dress: tacntl ? $0010 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write:rrrrrrrr reset:00000000 r = reserved figure 11-5. tima counter registers (tacnth and tacntl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 217 11.10.3 tima counter modulo registers the read/write tima modulo registers contain the modulo value for the tima counter. when the tima counter reaches the modulo value, the overflow flag (tof) becomes set, and the tima counter resumes counting from $0000 at the next timer clock. writing to the high byte (tmodh) inhibits the tof bit and overflow interrupts until the low byte (tmodl) is written. reset sets the tima counter modulo registers. note: reset the tima counter before writing to the tima counter modulo registers. register name and ad- dress: tamodh ? $0011 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset:11111111 register name and ad- dress: tamodl ? $0012 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:11111111 figure 11-6. tima counter modulo registers (tmodh and tmodl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 218 timer interface a (tima) motorola timer interface a (tima) 11.10.4 tima channel status and control registers each of the tima channel status and control registers:  flags input captures and output compares  enables input capture and output compare interrupts  selects input capture, output compare, or pwm operation  selects high, low, or toggling output on output compare  selects rising edge, falling edge, or any edge as the active input capture trigger  selects output toggling on tima overflow  selects 0% and 100% pwm duty cycle  selects buffered or unbuffered output compare/pwm operation register name and ad- dress: tasc0 ? $0013 bit 7654321bit 0 read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0ma x write: 0 reset:00000000 register name and ad- dress: tasc1 ? $0016 bit 7654321bit 0 read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write: 0 r reset:00000000 r= reserved figure 11-7. tima channel status and control registers (tasc0 ? tasc1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 219 chxf ? channel x flag bit when channel x is an input capture channel, this read/write bit is set when an active edge occurs on the channel x pin. when channel x is an output compare channel, chxf is set when the value in the tima counter registers matches the value in the tima channel x registers. when chxie = 1, clear chxf by reading tima channel x status and control register with chxf set, and then writing a logic 0 to chxf. if another interrupt request occurs before the clearing sequence is complete, then writing logic 0 to chxf has no effect. therefore, an interrupt request cannot be lost due to inadvertent clearing of chxf. reset clears the chxf bit. writing a logic 1 to chxf has no effect. 1 = input capture or output compare on channel x 0 = no input capture or output compare on channel x chxie ? channel x interrupt enable bit this read/write bit enables tima cpu interrupts on channel x. reset clears the chxie bit. 1 = channel x cpu interrupt requests enabled 0 = channel x cpu interrupt requests disabled msxb ? mode select bit b this read/write bit selects buffered output compare/pwm operation. msxb exists only in the tima channel 0. setting ms0b disables the channel 1 status and control register and reverts tch1a to general-purpose i/o. reset clears the msxb bit. 1 = buffered output compare/pwm operation enabled 0 = buffered output compare/pwm operation disabled msxa ? mode select bit a when elsxb:a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 220 timer interface a (tima) motorola timer interface a (tima) note: before changing a channel function by writing to the msxb or msxa bit, set the tstop and trst bits in the tima status and control register (tasc). elsxb and elsxa ? edge/level select bits when channel x is an input capture channel, these read/write bits control the active edge-sensing logic on channel x. when channel x is an output compare channel, elsxb and elsxa control the channel x output behavior when an output compare occurs. when elsxb and elsxa are both clear, channel x is not connected to port b, and pin ptbx/tchxa is available as a general-purpose i/o pin. however, channel x is at a state determined by these bits and becomes transparent to the respective pin when pwm, input capture, or output compare mode is enabled. table 11-2 shows how elsxa and elsxa work. reset clears the elsxb and elsxa bits. table 11-2. mode, edge, and level selection msxb:msxa elsxb:elsxa mode configuration x0 00 output preset pin under port control: initialize timer output level high x1 00 pin under port control: initialize timer output level low 00 01 input capture capture on rising edge only 00 10 capture on falling edge only 00 11 capture on rising or falling edge 01 01 output compare or pwm toggle output on compare 01 10 clear output on compare 01 11 set output on compare 1x 01 buffered output compare or buffered pwm toggle output on compare 1x 10 clear output on compare 1x 11 set output on compare f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface a (tima) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface a (tima) 221 note: before enabling a tima channel register for input capture operation, make sure that the ptbx/tachx pin is stable for at least two bus clocks. tovx ? toggle-on-overflow bit when channel x is an output compare channel, this read/write bit controls the behavior of the channel x output when the tima counter overflows. when channel x is an input capture channel, tovx has no effect. reset clears the tovx bit. 1 = channel x pin toggles on tima counter overflow. 0 = channel x pin does not toggle on tima counter overflow. note: when tovx is set, a tima counter overflow takes precedence over a channel x output compare if both occur at the same time. chxmax ? channel x maximum duty cycle bit when the tovx bit is at logic 1, setting the chxmax bit forces the duty cycle of buffered and unbuffered pwm signals to 100 percent. as figure 11-8 shows, the chxmax bit takes effect in the cycle after it is set or cleared. the output stays at the 100 percent duty cycle level until the cycle after chxmax is cleared. figure 11-8. chxmax latency output overflow ptbx/tchx period chxmax overflow overflow overflow overflow compare output compare output compare output compare tovx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 222 timer interface a (tima) motorola timer interface a (tima) 11.10.5 tima channel registers these read/write registers contain the captured tima counter value of the input capture function or the output compare value of the output compare function. the state of the tima channel registers after reset is unknown. in input capture mode (msxb ? msxa = 0:0), reading the high byte of the tima channel x registers (tachxh) inhibits input captures until the low byte (tachxl) is read. in output compare mode (msxb ? msxa ? $0014 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset register name and address: tach0l ? $0015 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset register name and address: tach1h ? $0017 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset register name and address: tach1l ? $0018 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 11-9. tima channel registers (tach0h/l ? tach1h/l) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 223 technical data ? mc68hc908mr8 section 12. timer interface b (timb) 12.1 contents 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 12.4.1 timb counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.4.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.4.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.4.4 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . 231 12.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 12.6 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 12.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 12.8 timb during break interrupts . . . . . . . . . . . . . . . . . . . . . . . 236 12.9 timb channel i/o pins (ptb5/tch0b ? ptb6/tch1b) . . . . 237 12.10 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 12.10.1 timb status and control register . . . . . . . . . . . . . . . . . 237 12.10.2 timb counter registers . . . . . . . . . . . . . . . . . . . . . . . . . 240 12.10.3 timb counter modulo registers . . . . . . . . . . . . . . . . . . . 241 12.10.4 timb channel status and control registers . . . . . . . . . 242 12.10.5 timb channel registers . . . . . . . . . . . . . . . . . . . . . . . . . 245 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 224 timer interface b (timb) motorola timer interface b (timb) 12.2 introduction this section describes the timer interface module (timb). the timb is a 2-channel timer that provides:  a timing reference with input capture  output compare  pulse width modulation (pwm) functions refer to figure 12-1 for a block diagram of the timb and to figure 12-2 for a summary of the registers. for further information regarding timers on m68hc08 family devices, please consult the hc08 timer reference manual, tim08rm/ad. 12.3 features features of the timb include:  two input capture/output compare channels ? rising-edge, falling-edge, or any-edge input capture trigger ? set, clear, or toggle output compare action  buffered and unbuffered pwm signal generation  programmable timb clock with 7-frequency internal bus clock prescaler selection  free-running or modulo up-count operation  toggle any channel pin on overflow  timb counter stop and reset bits f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) features mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 225 figure 12-1. timb block diagram prescaler prescaler select internal 16-bit comparator ps2 ps1 ps0 16-bit comparator 16-bit latch tch0h:tch0l ms0a els0b els0a tof toie interrupt channel 0 tmodh:tmodl trst tstop tov0 ch0ie ch0f ch0max ms0b 16-bit counter bus clock ptb5/tch0b ptb6/tch1b 16-bit comparator 16-bit latch tch1h:tch1l ms1a els1b els1a channel 1 tov1 ch1ie ch1f ch1max ptb5 logic ptb6 logic interrupt logic interrupt logic logic addr. register name bit 7 6 5 4 3 2 1 bit 0 $0051 timb status/control regis- ter (tbsc) see page 238. read : tof toie tstop 00 ps2 ps1 ps0 write : 0trstr re- set: 00100000 $0052 timb counter register high (tbcnth) see page 240. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : rrrrrrrr re- set: 00000000 r= reserved figure 12-2. timb i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 226 timer interface b (timb) motorola timer interface b (timb) $0053 timb counter register low (tbcntl) see page 240. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : rrrrrrrr re- set: 00000000 $0054 timb counter modulo reg- ister high (tbmodh) see page 241. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: 11111111 $0055 timb counter modulo reg- ister low (tbmodl) see page 241. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: 11111111 $0056 timb channel 0 sta- tus/control register (tbsc0) see page 242. read : ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0ma x write : 0 re- set: 00000000 $0057 timb channel 0 register high (tbch0h) see page 246. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: indeterminate after reset addr. register name bit 7 6 5 4 3 2 1 bit 0 r= reserved figure 12-2. timb i/o register summary (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 227 12.4 functional description figure 12-1 shows the timb structure. the central component of the timb is the 16-bit timb counter that can operate as a free-running counter or a modulo up-counter. the timb counter provides the timing reference for the input capture and output compare functions. the timb counter modulo registers, tbmodh ? tbmodl, control the modulo value of the timb counter. software can read the timb counter value at any time without affecting the counting sequence. $0058 timb channel 0 register low (tbch0l) see page 246. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: indeterminate after reset $0059 timb channel 1 sta- tus/control register (tbsc1) see page 246. read : ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write : 0r re- set: 00000000 $005 a timb channel 1 register high (tbch1h) see page 246. read : bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write : re- set: indeterminate after reset $005 b timb channel 1 register low (tbch1l) see page 246. read : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write : re- set: indeterminate after reset addr. register name bit 7 6 5 4 3 2 1 bit 0 r= reserved figure 12-2. timb i/o register summary (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 228 timer interface b (timb) motorola timer interface b (timb) the two timb channels are programmable independently as input capture or output compare channels. 12.4.1 timb counter prescaler the timb clock source can be one of the seven prescaler outputs. the prescaler generates seven clock rates from the internal bus clock. the prescaler select bits, ps[2:0], in the timb status and control register select the timb clock source. 12.4.2 input capture an input capture function has three basic parts:  edge select logic  input capture latch  16-bit counter two 8-bit registers, which make up the 16-bit input capture register, are used to latch the value of the free-running counter after the corresponding input capture edge detector senses a defined transition. the polarity of the active edge is programmable. the level transition which triggers the counter transfer is defined by the corresponding input edge bits (elsxb and elsxa in tbsc0 through tbsc1 control registers with x referring to the active channel number). when an active edge occurs on the pin of an input capture channel, the timb latches the contents of the timb counter into the timb channel registers, tchxh ? tchxl. input captures can generate timb cpu interrupt requests. software can determine that an input capture event has occurred by enabling input capture interrupts or by polling the status flag bit. the free-running counter contents are transferred to the timb channel status and control register, tbchxh ? tbchxl, (see 12.10.5 timb channel registers ) on each proper signal transition regardless of whether the timb channel flag (ch0f ? ch1f in tbsc0 ? tbsc1 registers) is set or clear. when the status flag is set, a cpu interrupt is generated if enabled. the value of the count latched or ? captured ? is the time of the event. because this value is stored in the input capture register two bus cycles after the actual event occurs, user software can f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 229 respond to this event at a later time and determine the actual time of the event. however, this must be done prior to another input capture on the same pin; otherwise, the previous time value will be lost. by recording the times for successive edges on an incoming signal, software can determine the period and/or pulse width of the signal. to measure a period, two successive edges of the same polarity are captured. to measure a pulse width, two alternate polarity edges are captured. software should track the overflows at the 16-bit module counter to extend its range. another use for the input capture function is to establish a time reference. in this case, an input capture function is used in conjunction with an output compare function. for example, to activate an output signal a specified number of clock cycles after detecting an input event (edge), use the input capture function to record the time at which the edge occurred. a number corresponding to the desired delay is added to this captured value and stored to an output compare register (see 12.10.5 timb channel registers ). because both input captures and output compares are referenced to the same 16-bit modulo counter, the delay can be controlled to the resolution of the counter independent of software latencies. note: reset does not affect the contents of the input capture channel register (tbchxh ? tbchxl). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 230 timer interface b (timb) motorola timer interface b (timb) 12.4.3 output compare with the output compare function, the timb can generate a periodic pulse with a programmable polarity, duration, and frequency. when the counter reaches the value in the registers of an output compare channel, the timb can set, clear, or toggle the channel pin. output compares can generate timb cpu interrupt requests. 12.4.3.1 unbuffered output compare any output compare channel can generate unbuffered output compare pulses as described in 12.4.3 output compare . the pulses are unbuffered because changing the output compare value requires writing the new value over the old value currently in the timb channel registers. an unsynchronized write to the timb channel registers to change an output compare value could cause incorrect operation for up to two counter overflow periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that counter overflow period. also, using a timb overflow interrupt routine to write a new, smaller output compare value may cause the compare to be missed. the timb may pass the new value before it is written. use these methods to synchronize unbuffered changes in the output compare value on channel x:  when changing to a smaller value, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current output compare pulse. the interrupt routine has until the end of the counter overflow period to write the new value.  when changing to a larger output compare value, enable timb overflow interrupts and write the new value in the timb overflow interrupt routine. the timb overflow interrupt occurs at the end of the current counter overflow period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same counter overflow period. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 231 12.4.3.2 buffered output compare channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the ptb5/tch0b pin. the timb channel registers of the linked pair alternately control the output. setting the ms0b bit in timb channel 0 status and control register (tbsc0) links channel 0 and channel 1. the output compare value in the timb channel 0 registers initially controls the output on the ptb5/tch0b pin. writing to the timb channel 1 registers enables the timb channel 1 registers to synchronously control the output after the timb overflows. at each subsequent overflow, the timb channel registers (0 or 1) that control the output are the ones written to last. tsc0 controls and monitors the buffered output compare function, and timb channel 1 status and control register (tbsc1) is unused. while the ms0b bit is set, the channel 1 pin, ptb6/tch1b, is available as a general-purpose input/output (i/o) pin. note: in buffered output compare operation, do not write new output compare values to the currently active channel registers. user software should track the currently active channel to prevent writing a new value to the active channel. writing to the active channel registers is the same as generating unbuffered output compares. 12.4.4 pulse-width modulation (pwm) by using the toggle-on-overflow feature with an output compare channel, the timb can generate a pwm signal. the value in the timb counter modulo registers determines the period of the pwm signal. the channel pin toggles when the counter reaches the value in the timb counter modulo registers. the time between overflows is the period of the pwm signal. as figure 12-3 shows, the output compare value in the timb channel registers determines the pulse width of the pwm signal. the time between overflow and output compare is the pulse width. program the timb to clear the channel pin on output compare if the state of the pwm pulse is logic 1. program the timb to set the pin if the state of the pwm pulse is logic 0. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 232 timer interface b (timb) motorola timer interface b (timb) figure 12-3. pwm period and pulse width the value in the timb counter modulo registers and the selected prescaler output determines the frequency of the pwm output. the frequency of an 8-bit pwm signal is variable in 256 increments. writing $00ff (255) to the timb counter modulo registers produces a pwm period of 256 times the internal bus clock period if the prescaler select value is $000 (see 12.10.1 timb status and control register ). the value in the timb channel registers determines the pulse width of the pwm output. the pulse width of an 8-bit pwm signal is variable in 256 increments. writing $0080 (128) to the timb channel registers produces a duty cycle of 128/256 or 50 percent. 12.4.4.1 unbuffered pwm signal generation any output compare channel can generate unbuffered pwm pulses as described in 12.4.4 pulse-width modulation (pwm) . the pulses are unbuffered because changing the pulse width requires writing the new pulse width value over the value currently in the timb channel registers. an unsynchronized write to the timb channel registers to change a pulse width value could cause incorrect operation for up to two pwm periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that pwm period. also, using a timb overflow interrupt routine to write a new, smaller pulse width value may cause the compare to be missed. the timb may pass the new value before it is written to the timb channel registers. ptbx/tchx period pulse width overflow overflow overflow output compare output compare output compare f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) functional description mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 233 use these methods to synchronize unbuffered changes in the pwm pulse width on channel x:  when changing to a shorter pulse width, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current pulse. the interrupt routine has until the end of the pwm period to write the new value.  when changing to a longer pulse width, enable timb overflow interrupts and write the new value in the timb overflow interrupt routine. the timb overflow interrupt occurs at the end of the current pwm period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same pwm period. note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare also can cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 12.4.4.2 buffered pwm signal generation channels 0 and 1 can be linked to form a buffered pwm channel whose output appears on the ptb5/tch0b pin. the timb channel registers of the linked pair alternately control the pulse width of the output. setting the ms0b bit in timb channel 0 status and control register (tbsc0) links channel 0 and channel 1. the timb channel 0 registers initially control the pulse width on the ptb5/tch0b pin. writing to the timb channel 1 registers enables the timb channel 1 registers to synchronously control the pulse width at the beginning of the next pwm period. at each subsequent overflow, the timb channel registers (0 or 1) that control the pulse width are the ones written to last. tbsc0 controls and monitors the buffered pwm function, and timb channel 1 status and control register (tbsc1) is unused. while the ms0b bit is set, the channel 1 pin, ptb6/tch1b, is available as a general-purpose i/o pin. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 234 timer interface b (timb) motorola timer interface b (timb) note: in buffered pwm signal generation, do not write new pulse width values to the currently active channel registers. user software should track the currently active channel to prevent writing a new value to the active channel. writing to the active channel registers is the same as generating unbuffered pwm signals. 12.4.4.3 pwm initialization to ensure correct operation when generating unbuffered or buffered pwm signals, use this initialization procedure: 1. in the timb status and control register (tbsc): a. stop the timb counter by setting the timb stop bit, tstop. b. reset the timb counter and prescaler by setting the timb reset bit, trst. 2. in the timb counter modulo registers (tbmodh ? tbmodl), write the value for the required pwm period. 3. in the timb channel x registers (tbchxh ? tbchxl), write the value for the required pulse width. 4. in timb channel x status and control register (tbscx): a. write 0:1 (for unbuffered output compare or pwm signals) or 1:0 (for buffered output compare or pwm signals) to the mode select bits, msxb ? msxa. see table 12-2 . b. write 1 to the toggle-on-overflow bit, tovx. c. write 1:0 (to clear output on compare) or 1:1 (to set output on compare) to the edge/level select bits, elsxb ? elsxa. the output action on compare must force the output to the complement of the pulse width level. see table 12-2 . note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare can also cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 5. in the timb status control register (tbsc), clear the timb stop bit, tstop. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) interrupts mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 235 setting ms0b links channels 0 and 1 and configures them for buffered pwm operation. the timb channel 0 registers (tbch0h ? tbch0l) initially control the buffered pwm output. timb status control register 0 (tbsc0) controls and monitors the pwm signal from the linked channels. ms0b takes priority over ms0a. clearing the toggle-on-overflow bit, tovx, inhibits output toggles on timb overflows. subsequent output compares try to force the output to a state it is already in and have no effect. the result is a 0 percent duty cycle output. setting the channel x maximum duty cycle bit (chxmax) and setting the tovx bit generates a 100 percent duty cycle output. see 12.10.4 timb channel status and control registers . 12.5 interrupts these timb sources can generate interrupt requests:  timb overflow flag (tof) ? the tof bit is set when the timb counter reaches the modulo value programmed in the timb counter modulo registers. the timb overflow interrupt enable bit, toie, enables timb overflow cpu interrupt requests. tof and toie are in the timb status and control register.  timb channel flags (ch1f ? ch0f) ? the chxf bit is set when an input capture or output compare occurs on channel x. channel x timb cpu interrupt requests are controlled by the channel x interrupt enable bit, chxie. 12.6 wait mode the wait instruction puts the mcu in low-power standby mode. the timb remains active after the execution of a wait instruction. in wait mode, the timb registers are not accessible by the cpu. any enabled cpu interrupt request from the timb can bring the mcu out of wait mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 236 timer interface b (timb) motorola timer interface b (timb) if timb functions are not required during wait mode, reduce power consumption by stopping the timb before executing the wait instruction. 12.7 stop mode timb is inactive after execution of a stop instruction. the stop instruction does not affect register conditions or the state of the timb counter. timb operation resumes when the mcu exits stop mode after an external interrupt. 12.8 timb during break interrupts a break interrupt stops the timb counter and inhibits input captures. the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. see 7.7.5 sim break flag control register . to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) timb channel i/o pins (ptb5/tch0b ? ptb6/tch1b) mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 237 12.9 timb channel i/o pins (ptb5/tch0b ? ptb6/tch1b) port b shares two of its pins with the timb. the two timb channel i/o pins are ptb5/tch0b and ptb6/tch1b. each channel i/o pin is programmable independently as an input capture pin or an output compare pin. ptb5/tch0b and ptb6/tch1b can be configured as buffered output compare or buffered pwm pins. 12.10 i/o registers these i/o registers control and monitor timb operation:  timb status and control register (tbsc)  timb control registers (tbcnth ? tbcntl)  timb counter modulo registers (tbmodh ? tbmodl)  timb channel status and control registers (tbsc0 and tbsc1)  timb channel registers (tbch0h ? tbch0l and tbch1h ? tbch1l) 12.10.1 timb status and control register the timb status and control register:  enables timb overflow interrupts  flags timb overflows  stops the timb counter  resets the timb counter  prescales the timb counter clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 238 timer interface b (timb) motorola timer interface b (timb) tof ? timb overflow flag bit this read/write flag is set when the timb counter reaches the modulo value programmed in the timb counter modulo registers. clear tof by reading the timb status and control register when tof is set and then writing a logic 0 to tof. if another timb overflow occurs before the clearing sequence is complete, then writing logic 0 to tof has no effect. therefore, a tof interrupt request cannot be lost due to inadvertent clearing of tof. reset clears the tof bit. writing a logic 1 to tof has no effect. 1 = timb counter has reached modulo value. 0 = timb counter has not reached modulo value. toie ? timb overflow interrupt enable bit this read/write bit enables timb overflow interrupts when the tof bit becomes set. reset clears the toie bit. 1 = timb overflow interrupts enabled 0 = timb overflow interrupts disabled tstop ? timb stop bit this read/write bit stops the timb counter. counting resumes when tstop is cleared. reset sets the tstop bit, stopping the timb counter until software clears the tstop bit. 1 = timb counter stopped 0 = timb counter active note: do not set the tstop bit before entering wait mode if the timb is required to exit wait mode. also, when the tstop bit is set and the timer is configured for input capture operation, input captures are inhibited until tstop is cleared. address : $0051 bit 7654321bit 0 read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst r reset:00100000 r= reserved figure 12-4. timb status and control register (tbsc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 239 trst ? timb reset bit setting this write-only bit resets the timb counter and the timb prescaler. setting trst has no effect on any other registers. counting resumes from $0000. trst is cleared automatically after the timb counter is reset and always reads as logic 0. reset clears the trst bit. 1 = prescaler and timb counter cleared 0 = no effect note: setting the tstop and trst bits simultaneously stops the timb counter at a value of $0000. ps[2:0] ? prescaler select bits these read/write bits select one of the seven prescaler outputs as the input to the timb counter as table 12-1 shows. reset clears the ps[2:0] bits. table 12-1. prescaler selection ps[2:0] timb clock source 000 internal bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 240 timer interface b (timb) motorola timer interface b (timb) 12.10.2 timb counter registers the two read-only timb counter registers contain the high and low bytes of the value in the timb counter. reading the high byte (tbcnth) latches the contents of the low byte (tbcntl) into a buffer. subsequent reads of tbcnth do not affect the latched tbcntl value until tbcntl is read. reset clears the timb counter registers. setting the timb reset bit (trst) also clears the timb counter registers. note: if tbcnth is read during a break interrupt, be sure to unlatch tbcntl by reading tbcntl before exiting the break interrupt. otherwise, tbcntl retains the value latched during the break. register name and ad- dress: tbcnth ? $0052 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write:rrrrrrrr reset:00000000 register name and ad- dress: tbcntl ? $0053 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write:rrrrrrrr reset:00000000 r = reserved figure 12-5. timb counter registers (tbcnth and tbcntl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 241 12.10.3 timb counter modulo registers the read/write timb modulo registers contain the modulo value for the timb counter. when the timb counter reaches the modulo value, the overflow flag (tof) becomes set, and the timb counter resumes counting from $0000 at the next timer clock. writing to the high byte (tmodh) inhibits the tof bit and overflow interrupts until the low byte (tmodl) is written. reset sets the timb counter modulo registers. note: reset the timb counter before writing to the timb counter modulo registers. register name and ad- dress: tbmodh ? $0054 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset:11111111 register name and ad- dress: tbmodl ? $0055 bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset:11111111 figure 12-6. timb counter modulo registers (tmodh and tmodl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 242 timer interface b (timb) motorola timer interface b (timb) 12.10.4 timb channel status and control registers each of the timb channel status and control registers:  flags input captures and output compares  enables input capture and output compare interrupts  selects input capture, output compare, or pwm operation  selects high, low, or toggling output on output compare  selects rising edge, falling edge, or any edge as the active input capture trigger  selects output toggling on timb overflow  selects 0% and 100% pwm duty cycle  selects buffered or unbuffered output compare/pwm operation chxf ? channel x flag bit when channel x is an input capture channel, this read/write bit is set when an active edge occurs on the channel x pin. when channel x is an output compare channel, chxf is set when the value in the timb counter registers matches the value in the timb channel x registers. register name and ad- dress: tbsc0 ? $0056 bit 7654321bit 0 read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0ma x write: 0 reset:00000000 register name and ad- dress: tbsc1 ? $0059 bit 7654321bit 0 read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1ma x write: 0 r reset:00000000 r= reserved figure 12-7. timb channel status and control registers (tbsc0 ? tbsc1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 243 when chxie = 1, clear chxf by reading timb channel x status and control register with chxf set, and then writing a logic 0 to chxf. if another interrupt request occurs before the clearing sequence is complete, then writing logic 0 to chxf has no effect. therefore, an interrupt request cannot be lost due to inadvertent clearing of chxf. reset clears the chxf bit. writing a logic 1 to chxf has no effect. 1 = input capture or output compare on channel x 0 = no input capture or output compare on channel x chxie ? channel x interrupt enable bit this read/write bit enables timb cpu interrupts on channel x. reset clears the chxie bit. 1 = channel x cpu interrupt requests enabled 0 = channel x cpu interrupt requests disabled msxb ? mode select bit b this read/write bit selects buffered output compare/pwm operation. msxb exists only in the timb channel 0. reset clears the msxb bit. 1 = buffered output compare/pwm operation enabled 0 = buffered output compare/pwm operation disabled msxa ? mode select bit a when elsxb:a note: before changing a channel function by writing to the msxb or msxa bit, set the tstop and trst bits in the timb status and control register (tbsc). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 244 timer interface b (timb) motorola timer interface b (timb) elsxb and elsxa ? edge/level select bits when channel x is an input capture channel, these read/write bits control the active edge-sensing logic on channel x. when channel x is an output compare channel, elsxb and elsxa control the channel x output behavior when an output compare occurs. when elsxb and elsxa are both clear, channel x is not connected to port b, and pin ptbx/tchxb is available as a general-purpose i/o pin. however, channel x is at a state determined by these bits and becomes transparent to the respective pin when pwm, input capture, or output compare mode is enabled. table 12-2 shows how elsxa and elsxa work. reset clears the elsxb and elsxa bits. note: before enabling a timb channel register for input capture operation, make sure that the ptbx/tbchx pin is stable for at least two bus clocks. table 12-2. mode, edge, and level selection msxb:msxa elsxb:elsxa mode configuration x0 00 output preset pin under port control; initialize timer output level high x1 00 pin under port control; initialize timer output level low 00 01 input capture capture on rising edge only 00 10 capture on falling edge only 00 11 capture on rising or falling edge 01 01 output compare or pwm toggle output on compare 01 10 clear output on compare 01 11 set output on compare 1x 01 buffered output compare or buffered pwm toggle output on compare 1x 10 clear output on compare 1x 11 set output on compare f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
timer interface b (timb) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola timer interface b (timb) 245 tovx ? toggle-on-overflow bit when channel x is an output compare channel, this read/write bit controls the behavior of the channel x output when the timb counter overflows. when channel x is an input capture channel, tovx has no effect. reset clears the tovx bit. 1 = channel x pin toggles on timb counter overflow. 0 = channel x pin does not toggle on timb counter overflow. note: when tovx is set, a timb counter overflow takes precedence over a channel x output compare if both occur at the same time. chxmax ? channel x maximum duty cycle bit when the tovx bit is at logic 1, setting the chxmax bit forces the duty cycle of buffered and unbuffered pwm signals to 100 percent. as figure 12-8 shows, the chxmax bit takes effect in the cycle after it is set or cleared. the output stays at the 100 percent duty cycle level until the cycle after chxmax is cleared. figure 12-8. chxmax latency 12.10.5 timb channel registers these read/write registers contain the captured timb counter value of the input capture function or the output compare value of the output compare function. the state of the timb channel registers after reset is unknown. output overflow ptbx/tchx period chxmax overflow overflow overflow overflow compare output compare output compare output compare tovx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 246 timer interface b (timb) motorola timer interface b (timb) in input capture mode (msxb ? msxa = 0:0), reading the high byte of the timb channel x registers (tbchxh) inhibits input captures until the low byte (tbchxl) is read. in output compare mode (msxb ? msxa ? $0057 bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset register name and address: tbch0l ? $0058 bit 7654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset register name and address: tbch1h ? $005a bit 7654321bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset register name and address: tbch1l ? $005b bit 7654321bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 12-9. timb channel registers (tbch0h/l ? tbch1h/l) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 247 technical data ? mc68hc908mr8 section 13. serial communications interface (sci) 13.1 contents 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 13.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 13.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 13.4.1 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 13.4.2 transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 13.4.3 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 13.5 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 13.6 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 13.7 sci during break module interrupts . . . . . . . . . . . . . . . . . . 262 13.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 13.8.1 pte2/txd (transmit data) . . . . . . . . . . . . . . . . . . . . . . . . 263 13.8.2 ptb0/rxd (receive data) . . . . . . . . . . . . . . . . . . . . . . . . 263 13.9 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 13.9.1 sci control register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 13.9.2 sci control register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 13.9.3 sci control register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 13.9.4 sci status register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 13.9.5 sci status register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 13.9.6 sci data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 13.9.7 sci baud rate register . . . . . . . . . . . . . . . . . . . . . . . . . . 276 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 248 serial communications interface (sci) motorola serial communications interface (sci) 13.2 introduction this section describes the serial communications interface (sci) module which allows high-speed asynchronous communications with peripheral devices and other microcontroller units (mcus). 13.3 features features of the sci module include:  full duplex operation  standard mark/space non-return-to-zero (nrz) format  32 programmable baud rates  programmable 8-bit or 9-bit character length  separately enabled transmitter and receiver  separate receiver and transmitter cpu interrupt requests  separate receiver and transmitter  programmable transmitter output polarity  two receiver wakeup methods: ? idle line wakeup ? address mark wakeup f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 249  interrupt-driven operation with eight interrupt flags: ? transmitter empty ? transmission complete ? receiver full ? idle receiver input ? receiver overrun ? noise error ? framing error ? parity error  receiver framing error detection  hardware parity checking  1/16 bit-time noise detection 13.4 functional description the sci allows full-duplex, asynchronous, nrz serial communication among the mcu and remote devices, including other mcus. the transmitter and receiver of the sci operate independently, although they use the same baud rate generator. during normal operation, the cpu monitors the status of the sci, writes the data to be transmitted, and processes received data. figure 13-1 shows the structure of the sci module. figure 13-2 provides a summary of the input/output (i/o) registers. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 250 serial communications interface (sci) motorola serial communications interface (sci) figure 13-1. sci module block diagram scte tc scrf idle or nf fe pe sctie tcie scrie ilie te re rwu sbk r8 t8 orie feie peie bkf rpf sci data receive shift register sci data register transmit shift register neie m wake ilty flag control transmit control receive control data selection control wakeup pty pen register transmitter interrupt control receiver interrupt control error interrupt control control ensci loops ensci ptb0/rxd ptb1/txd internal bus txinv loops 4 16 pre- scaler baud rate generator f op f op = f bus frequency f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 251 13.4.1 data format the sci uses the standard non-return-to-zero mark/space data format illustrated in figure 13-3 . addr. register name bit 7 6 5 4 3 2 1 bit 0 $0038 sci control register 1 (scc1) see page 264. read: loop s ensci txinv m wake ilty pen pty write: reset:00000000 $0039 sci control register 2 (scc2) see page 267. read: sctie tcie scrie ilie te re rwu sbk write: reset:00000000 $003a sci control register 3 (scc3) see page 270. read: r8 t8 00 orie neie feie peie write: r r r reset:uu000000 $003b sci status register 1 (scs1) see page 271. read: scte tc scrf idle or nf fe pe write:rrrrrrrr reset:11000000 $003c sci status register 2 (scs2) see page 275. read:000000bkfrpf write:rrrrrrrr reset:00000000 $003d sci data register (scdr) see page 276. read:r7r6r5r4r3r2r1r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset $003e sci baud rate register (scbr) see page 276. read: 0 0 scp1 scp0 0 scr2 scr1 scr0 write: r r r reset:00000000 r = reserved u = unaffected figure 13-2. sci i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 252 serial communications interface (sci) motorola serial communications interface (sci) figure 13-3. sci data formats 13.4.2 transmitter figure 13-4 shows the structure of the sci transmitter. 13.4.2.1 character length the transmitter can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (scc1) determines character length. when transmitting 9-bit data, bit t8 in sci control register 3 (scc3) is the ninth bit (bit 8). 13.4.2.2 character transmission during an sci transmission, the transmit shift register shifts a character out to the ptb1/txd pin. the sci data register (scdr) is the write-only buffer between the internal data bus and the transmit shift register. to initiate an sci transmission: 1. enable the sci by writing a logic 1 to the enable sci bit (ensci) in sci control register 1 (scc1). 2. enable the transmitter by writing a logic 1 to the transmitter enable bit (te) in sci control register 2 (scc2). 3. clear the sci transmitter empty bit by first reading sci status register 1 (scs1) and then writing to the scdr. 4. repeat step 3 for each subsequent transmission. bit 5 start bit bit 0 bit 1 next stop bit start bit 8-bit data format bit m in scc1 clear start bit bit 0 next stop bit start bit 9-bit data format bit m in scc1 set bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 2 bit 3 bit 4 bit 6 bit 7 possible parity bit possible parity bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 253 at the start of a transmission, transmitter control logic automatically loads the transmit shift register with a preamble of logic 1s. after the preamble shifts out, control logic transfers the scdr data into the transmit shift register. a logic 0 start bit automatically goes into the least significant bit (lsb) position of the transmit shift register. a logic 1 stop bit goes into the most significant bit (msb) position. the sci transmitter empty bit, scte, in scs1 becomes set when the scdr transfers a byte to the transmit shift register. the scte bit indicates that the scdr can accept new data from the internal data bus. if the sci transmit interrupt enable bit, sctie, in scc2 is also set, the scte bit generates a transmitter cpu interrupt request. when the transmit shift register is not transmitting a character, the ptb1/txd pin goes to the idle condition, logic 1. if at any time software clears the ensci bit in sci control register 1 (scc1), the transmitter and receiver relinquish control of the port b pins. 13.4.2.3 break characters writing a logic 1 to the send break bit, sbk, in scc2 loads the transmit shift register with a break character. a break character contains all logic 0s and has no start, stop, or parity bit. break character length depends on the m bit in scc1. as long as sbk is at logic 1, transmitter logic continuously loads break characters into the transmit shift register. after software clears the sbk bit, the shift register finishes transmitting the last break character and then transmits at least one logic 1. the automatic logic 1 at the end of a break character guarantees the recognition of the start bit of the next character. the sci recognizes a break character when a start bit is followed by eight or nine logic 0 data bits and a logic 0 where the stop bit should be. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 254 serial communications interface (sci) motorola serial communications interface (sci) figure 13-4. sci transmitter receiving a break character has these effects on sci registers:  sets the framing error bit (fe) in scs1  sets the sci receiver full bit (scrf) in scs1  clears the sci data register (scdr)  clears the r8 bit in scc3  sets the break flag bit (bkf) in scs2  may set the overrun (or), noise flag (nf), parity error (pe), or reception-in-progress flag (rpf) bits pen pty h876543210l 11-bit transmit stop start t8 scte sctie tcie sbk tc f op parity generation msb sci data register load from scdr shift enable preamble all 1s break all 0s transmitter control logic shift register tc sctie tcie scte transmitter cpu m ensci loops te ptb1/txd txinv internal bus 4 pre- scaler scp1 scp0 scr2 scr1 scr0 baud divider 16 interrupt request f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 255 13.4.2.4 idle characters an idle character contains all logic 1s and has no start, stop, or parity bit. idle character length depends on the m bit in scc1. the preamble is a synchronizing idle character that begins every transmission. if the te bit is cleared during a transmission, the ptb1/txd pin becomes idle after completion of the transmission in progress. clearing and then setting the te bit during a transmission queues an idle character to be sent after the character currently being transmitted. note: when queueing an idle character, return the te bit to logic 1 before the stop bit of the current character shifts out to the ptb1/txd pin. setting te after the stop bit appears on ptb1/txd causes data previously written to the scdr to be lost. a good time to toggle the te bit is when the scte bit becomes set and just before writing the next byte to the scdr. 13.4.2.5 inversion of transmitted output the transmit inversion bit (txinv) in sci control register 1 (scc1) reverses the polarity of transmitted data. all transmitted values, including idle, break, start, and stop bits, are inverted when txinv is at logic 1. see 13.9.1 sci control register 1 . 13.4.2.6 transmitter interrupts these conditions can generate cpu interrupt requests from the sci transmitter:  sci transmitter empty (scte) ? the scte bit in scs1 indicates that the scdr has transferred a character to the transmit shift register. scte can generate a transmitter cpu interrupt request. setting the sci transmit interrupt enable bit, sctie, in scc2 enables the scte bit to generate transmitter cpu interrupt requests.  transmission complete (tc) ? the tc bit in scs1 indicates that the transmit shift register and the scdr are empty and that no break or idle character has been generated. the transmission complete interrupt enable bit, tcie, in scc2 enables the tc bit to generate transmitter cpu interrupt requests. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 256 serial communications interface (sci) motorola serial communications interface (sci) 13.4.3 receiver figure 13-5 shows the structure of the sci receiver. figure 13-5. sci receiver block diagram all 1s all 0s m wake ilty pen pty bkf rpf h876543210l 11-bit receive shift register stop start data recovery or orie nf neie fe feie pe peie scrie scrf ilie idle wakeup logic parity checking msb error cpu interrupt request cpu interrupt request sci data register r8 orie neie feie peie scrie ilie rwu scrf idle or nf fe pe ptb0/rx internal bus pre- scaler baud divider 4 16 scp1 scp0 scr2 scr1 scr0 f op f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 257 13.4.3.1 character length the receiver can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (scc1) determines character length. when receiving 9-bit data, bit r8 in sci control register 2 (scc2) is the ninth bit (bit 8). when receiving 8-bit data, bit r8 is a copy of the eighth bit (bit 7). 13.4.3.2 character reception during an sci reception, the receive shift register shifts characters in from the ptb0/rxd pin. the sci data register (scdr) is the read-only buffer between the internal data bus and the receive shift register. after a complete character shifts into the receive shift register, the data portion of the character transfers to the scdr. the sci receiver full bit, scrf, in sci status register 1 (scs1) becomes set, indicating that the received byte can be read. if the sci receive interrupt enable bit, scrie, in scc2 is also set, the scrf bit generates a receiver cpu interrupt request. 13.4.3.3 data sampling the receiver samples the ptb0/rxd pin at the rt clock rate. the rt clock is an internal signal with a frequency 16 times the baud rate. to adjust for baud rate mismatch, the rt clock is resynchronized at these times (see figure 13-6 ):  after every start bit  after the receiver detects a data bit change from logic 1 to logic 0 (after the majority of data bit samples at rt8, rt9, and rt10 return a valid logic 1 and the majority of the next rt8, rt9, and rt10 samples return a valid logic 0) to locate the start bit, data recovery logic does an asynchronous search for a logic 0 preceded by three logic 1s. when the falling edge of a possible start bit occurs, the rt clock begins to count to 16. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 258 serial communications interface (sci) motorola serial communications interface (sci) figure 13-6. receiver data sampling to verify the start bit and to detect noise, data recovery logic takes samples at rt3, rt5, and rt7. table 13-1 summarizes the results of the start bit verification samples. if start bit verification is not successful, the rt clock is reset and a new search for a start bit begins. rt clock reset rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt8 rt7 rt6 rt11 rt10 rt9 rt15 rt14 rt13 rt12 rt16 rt1 rt2 rt3 rt4 start bit qualification start bit verification data sampling samples rt clock rt clock state start bit lsb ptb0/rxd table 13-1. start bit verification rt3, rt5, and rt7 samples start bit verification noise flag 000 yes 0 001 yes 1 010 yes 1 011 no 0 100 yes 1 101 no 0 110 no 0 111 no 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 259 to determine the value of a data bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 13-2 summarizes the results of the data bit samples. note: the rt8, rt9, and rt10 samples do not affect start bit verification. if any or all of the rt8, rt9, and rt10 start bit samples are logic 1s following a successful start bit verification, the noise flag (nf) is set and the receiver assumes that the bit is a start bit. to verify a stop bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 13-3 summarizes the results of the stop bit samples. table 13-2. data bit recovery rt8, rt9, and rt10 samples data bit determination noise flag 000 0 0 001 0 1 010 0 1 011 1 1 100 0 1 101 1 1 110 1 1 111 1 0 table 13-3. stop bit recovery rt8, rt9, and rt10 samples framing error flag noise flag 000 1 0 001 1 1 010 1 1 011 0 1 100 1 1 101 0 1 110 0 1 111 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 260 serial communications interface (sci) motorola serial communications interface (sci) 13.4.3.4 framing errors if the data recovery logic does not detect a logic 1 where the stop bit should be in an incoming character, it sets the framing error bit, fe, in scs1. the fe flag is set at the same time that the scrf bit is set. a break character that has no stop bit also sets the fe bit. 13.4.3.5 receiver wakeup so that the mcu can ignore transmissions intended only for other receivers in multiple-receiver systems, the receiver can be put into a standby state. setting the receiver wakeup bit, rwu, in scc2 puts the receiver into a standby state during which receiver interrupts are disabled. depending on the state of the wake bit in scc1, either of two conditions on the ptb0/rxd pin can bring the receiver out of the standby state:  address mark ? an address mark is a logic 1 in the most significant bit position of a received character. when the wake bit is set, an address mark wakes the receiver from the standby state by clearing the rwu bit. the address mark also sets the sci receiver full bit, scrf. software can then compare the character containing the address mark to the user-defined address of the receiver. if they are the same, the receiver remains awake and processes the characters that follow. if they are not the same, software can set the rwu bit and put the receiver back into the standby state.  idle input line condition ? when the wake bit is clear, an idle character on the ptb0/rxd pin wakes the receiver from the standby state by clearing the rwu bit. the idle character that wakes the receiver does not set the receiver idle bit, idle, or the sci receiver full bit, scrf. the idle line type bit, ilty, determines whether the receiver begins counting logic 1s as idle character bits after the start bit or after the stop bit. note: clearing the wake bit after the ptb0/rxd pin has been idle can cause the receiver to wake up immediately. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 261 13.4.3.6 receiver interrupts these sources can generate cpu interrupt requests from the sci receiver:  sci receiver full (scrf) ? the scrf bit in scs1 indicates that the receive shift register has transferred a character to the scdr. scrf can generate a receiver cpu interrupt request. setting the sci receive interrupt enable bit, scrie, in scc2 enables the scrf bit to generate receiver cpu interrupts.  idle input (idle) ? the idle bit in scs1 indicates that 10 or 11 consecutive logic 1s shifted in from the ptb0/rxd pin. the idle line interrupt enable bit, ilie, in scc2 enables the idle bit to generate cpu interrupt requests. 13.4.3.7 error interrupts these receiver error flags in scs1 can generate cpu interrupt requests:  receiver overrun (or) ? the or bit indicates that the receive shift register shifted in a new character before the previous character was read from the scdr. the previous character remains in the scdr, and the new character is lost. the overrun interrupt enable bit, orie, in scc3 enables or to generate sci error cpu interrupt requests.  noise flag (nf) ? the nf bit is set when the sci detects noise on incoming data or break characters, including start, data, and stop bits. the noise error interrupt enable bit, neie, in scc3 enables nf to generate sci error cpu interrupt requests.  framing error (fe) ? the fe bit in scs1 is set when a logic 0 occurs where the receiver expects a stop bit. the framing error interrupt enable bit, feie, in scc3 enables fe to generate sci error cpu interrupt requests.  parity error (pe) ? the pe bit in scs1 is set when the sci detects a parity error in incoming data. the parity error interrupt enable bit, peie, in scc3 enables pe to generate sci error cpu interrupt requests. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 262 serial communications interface (sci) motorola serial communications interface (sci) 13.5 wait mode the wait and stop instructions put the mcu in low power- consumption standby modes. the sci module remains active after the execution of a wait instruction. in wait mode the sci module registers are not accessible by the cpu. any enabled cpu interrupt request from the sci module can bring the mcu out of wait mode. if sci module functions are not required during wait mode, reduce power consumption by disabling the module before executing the wait instruction. 13.6 stop mode the sci module is inactive after execution of a stop instruction. the stop instruction does not affect register conditions of the sci. sci operation resumes when the mcu exits stop mode after an external interrupt. 13.7 sci during break module interrupts the system integration module (sim) controls whether status bits in other modules can be cleared during interrupts generated by the break module. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o signals mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 263 13.8 i/o signals port b shares two of its pins with the sci module. the two sci i/o pins are:  ptb1/txd ? transmit data  ptb0/rxd ? receive data 13.8.1 pte2/txd (transmit data) the ptb1/txd pin is the serial data output from the sci transmitter. the sci shares the ptb1/txd pin with port b. when the sci is enabled, the ptb1/txd pin is an output regardless of the state of the ddrf1 bit in data direction register b (ddrb). 13.8.2 ptb0/rxd (receive data) the ptb0/rxd pin is the serial data input to the sci receiver. the sci shares the ptb0/rxd pin with port b. when the sci is enabled, the ptb0/rxd pin is an input regardless of the state of the ddrb0 bit in data direction register b (ddrb). 13.9 i/o registers these i/o registers control and monitor sci operation:  sci control register 1 (scc1)  sci control register 2 (scc2)  sci control register 3 (scc3)  sci status register 1 (scs1)  sci status register 2 (scs2)  sci data register (scdr)  sci baud rate register (scbr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 264 serial communications interface (sci) motorola serial communications interface (sci) 13.9.1 sci control register 1 sci control register 1 (scc1):  enables loop mode operation  enables the sci  controls output polarity  controls character length  controls sci wake-up method  controls idle character detection  enables parity function  controls parity type loops ? loop mode select bit this read/write bit enables loop mode operation. in loop mode the ptb0/rxd pin is disconnected from the sci, and the transmitter output goes into the receiver input. both the transmitter and the receiver must be enabled to use loop mode. reset clears the loops bit. 1 = loop mode enabled 0 = normal operation enabled ensci ? enable sci bit this read/write bit enables the sci and the sci baud rate generator. clearing ensci sets the scte and tc bits in sci status register 1 and disables transmitter interrupts. reset clears the ensci bit. 1 = sci enabled 0 = sci disabled ad- dress: $0038 bit 7654321bit 0 read: loops ensci txinv m wake ilty pen pty write: reset:00000000 figure 13-7. sci control register 1 (scc1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 265 txinv ? transmit inversion bit this read/write bit reverses the polarity of transmitted data. reset clears the txinv bit. 1 = transmitter output inverted 0 = transmitter output not inverted note: setting the txinv bit inverts all transmitted values, including idle, break, start, and stop bits. m ? mode (character length) bit this read/write bit determines whether sci characters are eight or nine bits long. (see table 13-4 .) the ninth bit can serve as an extra stop bit, as a receiver wakeup signal, or as a parity bit. reset clears the m bit. 1 = 9-bit sci characters 0 = 8-bit sci characters wake ? wakeup condition bit this read/write bit determines which condition wakes up the sci: a logic 1 (address mark) in the most significant bit (msb) position of a received character or an idle condition on the ptb0/rxd pin. reset clears the wake bit. 1 = address mark wakeup 0 = idle line wakeup ilty ? idle line type bit this read/write bit determines when the sci starts counting logic 1s as idle character bits. the counting begins either after the start bit or after the stop bit. if the count begins after the start bit, then a string of logic 1s preceding the stop bit may cause false recognition of an idle character. beginning the count after the stop bit avoids false idle character recognition, but requires properly synchronized transmissions. reset clears the ilty bit. 1 = idle character bit count begins after stop bit. 0 = idle character bit count begins after start bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 266 serial communications interface (sci) motorola serial communications interface (sci) pen ? parity enable bit this read/write bit enables the sci parity function (see table 13-4 ). when enabled, the parity function inserts a parity bit in the most significant bit position (see figure 13-3 ). reset clears the pen bit. 1 = parity function enabled 0 = parity function disabled pty ? parity bit this read/write bit determines whether the sci generates and checks for odd parity or even parity (see table 13-4 ). reset clears the pty bit. 1 = odd parity 0 = even parity note: changing the pty bit in the middle of a transmission or reception can generate a parity error. table 13-4. character format selection control bits character format mpen:pty start bits data bits parity stop bits character length (bits) 0 0x 1 8 none 1 10 1 0x 1 9 none 1 11 010 17even1 10 011 17odd1 10 110 18even1 11 111 18odd1 11 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 267 13.9.2 sci control register 2 sci control register 2 (scc2):  enables these cpu interrupt requests: ? enables the scte bit to generate transmitter cpu interrupt requests ? enables the tc bit to generate transmitter cpu interrupt requests ? enables the scrf bit to generate receiver cpu interrupt requests ? enables the idle bit to generate receiver cpu interrupt requests  enables the transmitter  enables the receiver  enables sci wake up  transmits sci break characters sctie ? sci transmit interrupt enable bit this read/write bit enables the scte bit to generate sci transmitter cpu interrupt requests. setting the sctie bit in scc3 enables scte cpu interrupt requests. reset clears the sctie bit. 1 = scte enabled to generate cpu interrupt 0 = scte not enabled to generate cpu interrupt ad- dress: $0039 bit 7654321bit 0 read: sctie tcie scrie ilie te re rwu sbk write: reset:00000000 figure 13-8. sci control register 2 (scc2) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 268 serial communications interface (sci) motorola serial communications interface (sci) tcie ? transmission complete interrupt enable bit this read/write bit enables the tc bit to generate sci transmitter cpu interrupt requests. reset clears the tcie bit. 1 = tc enabled to generate cpu interrupt requests 0 = tc not enabled to generate cpu interrupt requests scrie ? sci receive interrupt enable bit this read/write bit enables the scrf bit to generate sci receiver cpu interrupt requests. setting the scrie bit in scc3 enables the scrf bit to generate cpu interrupt requests. reset clears the scrie bit. 1 = scrf enabled to generate cpu interrupt 0 = scrf not enabled to generate cpu interrupt ilie ? idle line interrupt enable bit this read/write bit enables the idle bit to generate sci receiver cpu interrupt requests. reset clears the ilie bit. 1 = idle enabled to generate cpu interrupt requests 0 = idle not enabled to generate cpu interrupt requests te ? transmitter enable bit setting this read/write bit begins the transmission by sending a preamble of 10 or 11 logic 1s from the transmit shift register to the ptb1/txd pin. if software clears the te bit, the transmitter completes any transmission in progress before the ptb1/txd returns to the idle condition (logic 1). clearing and then setting te during a transmission queues an idle character to be sent after the character currently being transmitted. reset clears the te bit. 1 = transmitter enabled 0 = transmitter disabled note: writing to the te bit is not allowed when the enable sci bit (ensci) is clear. ensci is in sci control register 1. re ? receiver enable bit setting this read/write bit enables the receiver. clearing the re bit disables the receiver but does not affect receiver interrupt flag bits. reset clears the re bit. 1 = receiver enabled 0 = receiver disabled f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 269 note: writing to the re bit is not allowed when the enable sci bit (ensci) is clear. ensci is in sci control register 1. rwu ? receiver wakeup bit this read/write bit puts the receiver in a standby state during which receiver interrupts are disabled. the wake bit in scc1 determines whether an idle input or an address mark brings the receiver out of the standby state and clears the rwu bit. reset clears the rwu bit. 1 = standby state 0 = normal operation sbk ? send break bit setting and then clearing this read/write bit transmits a break character followed by a logic 1. the logic 1 after the break character guarantees recognition of a valid start bit. if sbk remains set, the transmitter continuously transmits break characters with no logic 1s between them. reset clears the sbk bit. 1 = transmit break characters 0 = no break characters being transmitted note: do not toggle the sbk bit immediately after setting the scte bit. toggling sbk too early causes the sci to send a break character instead of a preamble. 13.9.3 sci control register 3 sci control register 3 (scc3):  stores the ninth sci data bit received and the ninth sci data bit to be transmitted  enables sci receiver full (scrf)  enables sci transmitter empty (scte)  enables the following interrupts: ? receiver overrun interrupts ? noise error interrupts ? framing error interrupts ? parity error interrupts f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 270 serial communications interface (sci) motorola serial communications interface (sci) r8 ? received bit 8 when the sci is receiving 9-bit characters, r8 is the read-only ninth bit (bit 8) of the received character. r8 is received at the same time that the scdr receives the other 8 bits. when the sci is receiving 8-bit characters, r8 is a copy of the eighth bit (bit 7). reset has no effect on the r8 bit. t8 ? transmitted bit 8 when the sci is transmitting 9-bit characters, t8 is the read/write ninth bit (bit 8) of the transmitted character. t8 is loaded into the transmit shift register at the same time that the scdr is loaded into the transmit shift register. reset has no effect on the t8 bit. orie ? receiver overrun interrupt enable bit this read/write bit enables sci error cpu interrupt requests generated by the receiver overrun bit, or. 1 = sci error cpu interrupt requests from or bit enabled 0 = sci error cpu interrupt requests from or bit disabled neie ? receiver noise error interrupt enable bit this read/write bit enables sci error cpu interrupt requests generated by the noise error bit, ne. reset clears neie. 1 = sci error cpu interrupt requests from ne bit enabled 0 = sci error cpu interrupt requests from ne bit disabled ad- dress: $003a bit 7654321bit 0 read: r8 t8 00 orie neie feie peie write: r r r reset:uu000000 r = reserved u = unaffected figure 13-9. sci control register 3 (scc3) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 271 feie ? receiver framing error interrupt enable bit this read/write bit enables sci error cpu interrupt requests generated by the framing error bit, fe. reset clears feie. 1 = sci error cpu interrupt requests from fe bit enabled 0 = sci error cpu interrupt requests from fe bit disabled peie ? receiver parity error interrupt enable bit this read/write bit enables sci receiver cpu interrupt requests generated by the parity error bit, pe. reset clears peie. see 13.9.4 sci status register 1 1 = sci error cpu interrupt requests from pe bit enabled 0 = sci error cpu interrupt requests from pe bit disabled 13.9.4 sci status register 1 sci status register 1 (scs1) contains flags to signal these conditions:  transfer of scdr data to transmit shift register complete  transmission complete  transfer of receive shift register data to scdr complete  receiver input idle  receiver overrun  noisy data  framing error  parity error ad- dress: $003b bit 7654321bit 0 read: scte tc scrf idle or nf fe pe write:rrrrrrrr reset:11000000 r= reserved figure 13-10. sci status register 1 (scs1) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 272 serial communications interface (sci) motorola serial communications interface (sci) scte ? sci transmitter empty bit this clearable, read-only bit is set when the scdr transfers a character to the transmit shift register. scte can generate an sci transmitter cpu interrupt request. when the sctie bit in scc2 is set, scte generates an sci transmitter cpu interrupt request. in normal operation, clear the scte bit by reading scs1 with scte set and then writing to scdr. reset sets the scte bit. 1 = scdr data transferred to transmit shift register 0 = scdr data not transferred to transmit shift register tc ? transmission complete bit this read-only bit is set when the scte bit is set, and no data, preamble, or break character is being transmitted. tc generates an sci transmitter cpu interrupt request if the tcie bit in scc2 is also set. tc is cleared automatically when data, preamble, or break is queued and ready to be sent. there may be up to 1.5 transmitter clocks of latency between queueing data, preamble, and break and the transmission actually starting. reset sets the tc bit. 1 = no transmission in progress 0 = transmission in progress scrf ? sci receiver full bit this clearable, read-only bit is set when the data in the receive shift register transfers to the sci data register. scrf can generate an sci receiver cpu interrupt request. when the scrie bit in scc2 is set, scrf generates a cpu interrupt request. in normal operation, clear the scrf bit by reading scs1 with scrf set and then reading the scdr. reset clears scrf. 1 = received data available in scdr 0 = data not available in scdr idle ? receiver idle bit this clearable, read-only bit is set when 10 or 11 consecutive logic 1s appear on the receiver input. idle generates an sci error cpu interrupt request if the ilie bit in scc2 is also set. clear the idle bit by reading scs1 with idle set and then reading the scdr. after the receiver is enabled, it must receive a valid character that sets the scrf bit before an idle condition can set the idle bit. also, after the f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 273 idle bit has been cleared, a valid character must again set the scrf bit before an idle condition can set the idle bit. reset clears the idle bit. 1 = receiver input idle 0 = receiver input active or idle since the idle bit was cleared or ? receiver overrun bit this clearable, read-only bit is set when software fails to read the scdr before the receive shift register receives the next character. the or bit generates an sci error cpu interrupt request if the orie bit in scc3 is also set. the data in the shift register is lost, but the data already in the scdr is not affected. clear the or bit by reading scs1 with or set and then reading the scdr. reset clears the or bit. 1 = receive shift register full and scrf = 1 0 = no receiver overrun software latency may allow an overrun to occur between reads of scs1 and scdr in the flag-clearing sequence. figure 13-11 shows the normal flag-clearing sequence and an example of an overrun caused by a delayed flag-clearing sequence. the delayed read of scdr does not clear the or bit because or was not set when scs1 was read. byte 2 caused the overrun and is lost. the next flag-clearing sequence reads byte 3 in the scdr instead of byte 2. in applications that are subject to software latency or in which it is important to know which byte is lost due to an overrun, the flag-clearing routine can check the or bit in a second read of scs1 after reading the data register. nf ? receiver noise flag bit this clearable, read-only bit is set when the sci detects noise on the ptb0/rxd pin. nf generates an nf cpu interrupt request if the neie bit in scc3 is also set. clear the nf bit by reading scs1 and then reading the scdr. reset clears the nf bit. 1 = noise detected 0 = no noise detected f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 274 serial communications interface (sci) motorola serial communications interface (sci) fe ? receiver framing error bit this clearable, read-only bit is set when a logic 0 is accepted as the stop bit. fe generates an sci error cpu interrupt request if the feie bit in scc3 also is set. clear the fe bit by reading scs1 with fe set and then reading the scdr. reset clears the fe bit. 1 = framing error detected 0 = no framing error detected pe ? receiver parity error bit this clearable, read-only bit is set when the sci detects a parity error in incoming data. pe generates a pe cpu interrupt request if the peie bit in scc3 is also set. clear the pe bit by reading scs1 with pe set and then reading the scdr. reset clears the pe bit. 1 = parity error detected 0 = no parity error detected figure 13-11. flag clearing sequence byte 1 normal flag clearing sequence read scs1 scrf = 1 read scdr byte 1 scrf = 1 scrf = 1 byte 2 byte 3 byte 4 or = 0 read scs1 scrf = 1 or = 0 read scdr byte 2 scrf = 0 read scs1 scrf = 1 or = 0 scrf = 1 scrf = 0 read scdr byte 3 scrf = 0 byte 1 read scs1 scrf = 1 read scdr byte 1 scrf = 1 scrf = 1 byte 2 byte 3 byte 4 or = 0 read scs1 scrf = 1 or = 1 read scdr byte 3 delayed flag clearing sequence or = 1 scrf = 1 or = 1 scrf = 0 or = 1 scrf = 0 or = 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 275 13.9.5 sci status register 2 sci status register 2 (scs2) contains flags to signal these conditions:  break character detected  incoming data bkf ? break flag bit this clearable, read-only bit is set when the sci detects a break character on the ptb0/rxd pin. in scs1, the fe and scrf bits are also set. in 9-bit character transmissions, the r8 bit in scc3 is cleared. bkf does not generate a cpu interrupt request. clear bkf by reading scs2 with bkf set and then reading the scdr. once cleared, bkf can become set again only after logic 1s again appear on the ptb0/rxd pin followed by another break character. reset clears the bkf bit. 1 = break character detected 0 = no break character detected rpf ? reception-in-progress flag bit this read-only bit is set when the receiver detects a logic 0 during the rt1 time period of the start bit search. rpf does not generate an interrupt request. rpf is reset after the receiver detects false start bits (usually from noise or a baud rate mismatch, or when the receiver detects an idle character. polling rpf before disabling the sci module or entering stop mode can show whether a reception is in progress. 1 = reception in progress 0 = no reception in progress ad- dress: $003c bit 7654321bit 0 read:000000bkfrpf write:rrrrrrrr reset:00000000 r= reserved figure 13-12. sci status register 2 (scs2) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 276 serial communications interface (sci) motorola serial communications interface (sci) 13.9.6 sci data register the sci data register (scdr) is the buffer between the internal data bus and the receive and transmit shift registers. reset has no effect on data in the sci data register. r7/t7:r0/t0 ? receive/transmit data bits reading address $003d accesses the read-only received data bits, r7:r0. writing to address $003d writes the data to be transmitted, t7:t0. reset has no effect on the sci data register. 13.9.7 sci baud rate register the sci baud rate register (scbr) selects the baud rate for both the receiver and the transmitter. ad- dress: $003d bit 7654321bit 0 read:r7r6r5r4r3r2r1r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset figure 13-13. sci data register (scdr) ad- dress: $003e bit 7654321bit 0 read: 0 0 scp1 scp0 0 scr2 scr1 scr0 write: r r r reset:00000000 r= reserved figure 13-14. sci baud rate register (scbr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola serial communications interface (sci) 277 scp1 and scp0 ? sci baud rate prescaler bits these read/write bits select the baud rate prescaler divisor as shown in table 13-5 . reset clears scp1 and scp0. scr2 ? scr0 ? sci baud rate select bits these read/write bits select the sci baud rate divisor as shown in table 13-6 . reset clears scr2 ? scr0. use this formula to calculate the sci baud rate: baud rate = f op / 64 x pd x bd where: f op = clock source (f bus ) pd = prescaler divisor bd = baud rate divisor table 13-7 shows the sci baud rates that can be generated with a 4.00-mhz crystal and the cgm set for an f op of 8.00 mhz and with a 4.9152-mhz crystal with the cgm set for an an f op of 7.3728 mhz. table 13-5. sci baud rate prescaling scp1:scp0 prescaler divisor (pd) 00 1 01 3 10 4 11 13 table 13-6. sci baud rate selection scr2:scr1:scr0 baud rate divisor (bd) 000 1 001 2 010 4 011 8 100 16 101 32 110 64 111 128 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 278 serial communications interface (sci) motorola serial communications interface (sci) table 13-7. sci baud rate selection examples scp1:scp0 prescaler divisor (pd) scr2:scr1: scr0 baud rate divisor (bd) baud rate (f op = 7.3728 mhz) baud rate (f op = 8.00 mhz) 00 1 000 1 115,200.00 125,000.00 00 1 001 2 57,600.00 62,500.00 00 1 010 4 28,800.00 31,250.00 00 1 011 8 14,400.00 15,625.00 00 1 100 16 7200.00 7812.50 00 1 101 32 3600.00 3906.25 00 1 110 64 1800.00 1953.13 00 1 111 128 900.00 976.56 01 3 000 1 38,400.00 41,666.67 01 3 001 2 19,200.00 20,833.33 01 3 010 4 9600.00 10,416.67 01 3 011 8 4800.00 5208.33 01 3 100 16 2400.00 2604.17 01 3 101 32 1200.00 1302.08 01 3 110 64 600.00 651.04 01 3 111 128 300.00 325.52 10 4 000 1 28,800.00 31,250.00 10 4 001 2 14,400.00 15,625.50 10 4 010 4 7200.00 7812.50 10 4 011 8 3600.00 3906.25 10 4 100 16 1800.00 1953.13 10 4 101 32 900.00 976.56 10 4 110 64 450.00 488.28 10 4 111 128 225.00 244.14 11 13 000 1 8861.54 9615.38 11 13 001 2 4430.77 4807.69 11 13 010 4 2215.38 2403.85 11 13 011 8 1107.69 1201.92 11 13 100 16 553.85 600.96 11 13 101 32 276.92 300.48 11 13 110 64 138.46 150.24 11 13 111 128 69.23 75.12 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 279 technical data ? mc68hc908mr8 section 14. input/output (i/o) ports 14.1 contents 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 14.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 14.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 14.3.2 data direction register a . . . . . . . . . . . . . . . . . . . . . . . . 282 14.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 14.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 14.4.2 data direction register b . . . . . . . . . . . . . . . . . . . . . . . . 285 14.5 port c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 14.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 14.5.2 data direction register c . . . . . . . . . . . . . . . . . . . . . . . . 288 14.2 introduction fourteen bidirectional input-output (i/o) pins, two input pins, and six output pins form three parallel ports. when using the 28-pin package versions of the mc68hc908mr8, set the data direction register bits in ddra such that bits 6, 5, and 4 are written to a logic 1 (along with any other output bits on porta). setting porta ? s data direction register bits 6, 5, and 4 will terminate the input buffers on that port. note: connect any unused i/o pins to an appropriate logic level, either v dd or v ss . (pwm6 ? pwm1 pins require no termination). although the i/o ports do not require termination for proper operation, termination reduces excess current consumption and the possibility of electrostatic damage. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 280 input/output (i/o) ports motorola input/output (i/o) ports addr. register name bit 7654321bit 0 $0000 port a data register (pta) see page 281. read: pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset $0001 port b data register (ptb) see page 284. read: ptb6 ptb5 ptb4 ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset $0002 port c data register (ptc) see page 287. read: ptc1 ptc0 write: reset: unaffected by reset $0003 unimplemented $0004 data direction register a (ddra) see page 282. read: ddra 6 ddra 5 ddra 4 ddra 3 ddra 2 ddra 1 ddra 0 write: reset:00000000 $0005 data direction register b (ddrb) see page 284. read: ddrb 6 ddrb 5 ddrb 4 ddrb 3 ddrb 2 ddrb 1 ddrb 0 write: reset:00000000 $0006 data direction register c (ddrc) see page 287. read: ddrc 1 ddrc 0 write: reset: uuuuuu0 0 = unimple- mented r = reserved u = unaffected figure 14-1. i/o port register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
input/output (i/o) ports port a mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 281 14.3 port a port a is a 7-bit, general-purpose, bidirectional i/o port. 14.3.1 port a data register the port a data register (pta) contains a data latch for each of the eight port a pins. pta[6:0] ? port a data bits these read/write bits are software programmable. data direction of each port a pin is under the control of the corresponding bit in data direction register a. reset has no effect on port a data. ad- dress: $0000 bit 7654321bit 0 read: pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset = unimplemented figure 14-2. port a data register (pta) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 282 input/output (i/o) ports motorola input/output (i/o) ports 14.3.2 data direction register a data direction register a (ddra) determines whether each port a pin is an input or an output. writing a logic 1 to a ddra bit enables the output buffer for the corresponding port a pin; a logic 0 disables the output buffer. ddra[6:0] ? data direction register a bits these read/write bits control port a data direction. reset clears ddra[6:0], configuring all port a pins as inputs. 1 = corresponding port a pin configured as output 0 = corresponding port a pin configured as input note: avoid glitches on port a pins by writing to the port a data register before changing data direction register a bits from 0 to 1. figure 14-4 shows the port a i/o logic. ad- dress: $0004 bit 7654321bit 0 read: ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 = unimplemented figure 14-3. data direction register a (ddra) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
input/output (i/o) ports port a mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 283 figure 14-4. port a i/o circuit when bit ddrax is a logic 1, reading address $0000 reads the ptax data latch. when bit ddrax is a logic 0, reading address $0000 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 14-1 summarizes the operation of the port a pins. table 14-1. port a pin functions ddra bit pta bit i/o pin mode accesses to ddra accesses to pta read/write read write 0 x (1) 1. x = don ? t care input, hi-z (2) 2. hi-z = high impedance ddra[6:0] pin pta[6:0] (3) 3. writing affects data register, but does not affect input. 1 x output ddra[6:0] pta[6:0] pta[6:0] read ddra ($0004) write ddra ($0004) reset write pta ($0000) read pta ($0000) ptax ddrax ptax internal data bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 284 input/output (i/o) ports motorola input/output (i/o) ports 14.4 port b port b is a 7-bit general-purpose bidirectional i/o port that shares its pins with the serial communications interface (sci) module. 14.4.1 port b data register the port b data register (ptb) contains a data latch for each of the eight port b pins. ptb[6:0] ? port b data bits these read/write bits are software-programmable. data direction of each port b pin is under the control of the corresponding bit in data direction register b. reset has no effect on port b data. ad- dress: $0001 bit 7654321bit 0 read: ptb6 ptb5 ptb4 ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset = unimplemented figure 14-5. port b data register (ptb) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
input/output (i/o) ports port b mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 285 14.4.2 data direction register b data direction register b (ddrb) determines whether each port b pin is an input or an output. writing a logic 1 to a ddrb bit enables the output buffer for the corresponding port b pin; a logic 0 disables the output buffer. ddrb[6:0] ? data direction register b bits these read/write bits control port b data direction. reset clears ddrb[6:0], configuring all port b pins as inputs. 1 = corresponding port b pin configured as output 0 = corresponding port b pin configured as input note: avoid glitches on port b pins by writing to the port b data register before changing data direction register b bits from 0 to 1. figure 14-7 shows the port b i/o logic. ad- dress: $0005 bit 7654321bit 0 read: ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 = unimplemented figure 14-6. data direction register b (ddrb) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 286 input/output (i/o) ports motorola input/output (i/o) ports figure 14-7. port b i/o circuit when bit ddrbx is a logic 1, reading address $0001 reads the ptbx data latch. when bit ddrbx is a logic 0, reading address $0001 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 14-2 summarizes the operation of the port b pins. 14.5 port c port c is a 2-bit special-purpose i/o port sharing its pins with the pulse width modulator for motor control module (pmc) fault input pins. these two pins mirror the state of fault1 and fault4 pins. level changes on these input pins will be interpreted as fault conditions. the port c data register contains a data latch for each of the two port pins. table 14-2. port b pin functions ddrb bit ptb bit i/o pin mode accesses to ddrb accesses to ptb read/write read write 0 x (1) 1. x = don ? t care input, hi-z (2) 2. hi-z = high impedance ddrb[6:0] pin ptb[6:0] (3) 3. writing affects data register, but does not affect input. 1 x output ddrb[6:0] ptb[6:0] ptb[6:0] read ddrb ($0005) write ddrb ($0005) reset write ptb ($0001) read ptb ($0001) ptbx ddrbx ptbx internal data bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
input/output (i/o) ports port c mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 287 port c bit 1 is not used on the 28-pin packages. for that reason, a pull-down resistor is connected to v ss to prevent a false fault input on fault4. note: portc has the capability of being used as an output port. when either pin of portc is set as an output, by setting its respective portc data direction register bit, the respective fault pin logic is disconnected from that pin and the fault input will be defaulted to normal non-fault condition to facilitate the use of portc as an output pin and not interfere with the pwm generator. to regain the fault capability for the respective fault input pin, clear the portc data direction register bit for that pin. 14.5.1 port c data register the port c data register (ptc) contains a data latch for each of the two port c pins. ptc[1:0] ? port c data bits these read/write bits are software programmable. data direction of each port c pin is under the control of the corresponding bit in data direction register c. reset has no effect on port c data. ad- dress: $0002 bit 7654321bit 0 read: ptc1 ptc0 write: reset: unaffected by reset = unimplemented figure 14-8. port c data register (ptc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 288 input/output (i/o) ports motorola input/output (i/o) ports 14.5.2 data direction register c data direction register c (ddrc) determines whether each port c pin is an input or an output. writing a logic 1 to a ddrc bit enables the output buffer for the corresponding port c pin; a logic 0 disables the output buffer. ddrc[1:0] ? data direction register c bits these read/write bits control port c data direction. reset clears ddrc[1:0], configuring all port c pins as inputs. 1 = corresponding port c pin configured as output 0 = corresponding port c pin configured as input note: avoid glitches on port c pins by writing to the port c data register before changing data direction register c bits from 0 to 1. figure 14-10 shows the port c i/o logic. ad- dress: $0006 bit 7654321bit 0 read: ddrc1 ddrc0 write: reset:uuuuuu0 0 = unimplemented u = unaffected figure 14-9. data direction register c (ddrc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
input/output (i/o) ports port c mc68hc908mr8 ? rev 4.0 technical data motorola input/output (i/o) ports 289 figure 14-10. port c i/o circuit when bit ddrcx is a logic 1, reading address $0002 reads the ptcx data latch. when bit ddrcx is a logic 0, reading address $0002 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 14-3 summarizes the operation of the port c pins. table 14-3. port c pin functions ddrc bit ptc bit i/o pin mode accesses to ddrc accesses to ptc read/write read write 0 x (1) 1. x = don ? t care input, hi-z (2) 2. hi-z = high impedance on ptc0 and a pull-down r pd on ptc1 ddrc[1:0] pin ptc[1:0] (3) 3. writing affects data register, but does not affect input. 1 x output ddrc[1:0] ptc[1:0] ptc[1:0] read ddrc ($0006) write ddrc ($0006) reset write ptc ($0002) read ptc ($0002) ptcx ddrcx ptcx internal data bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 290 input/output (i/o) ports motorola input/output (i/o) ports f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola computer operating properly (cop) 291 technical data ? mc68hc908mr8 section 15. computer operating properly (cop) 15.1 contents 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 15.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 15.4 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.1 cgmxclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.2 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.3 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 15.4.4 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.4.5 reset vector fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.4.6 cop disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.6 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 15.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.8 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.9 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 15.10 cop module during break mode . . . . . . . . . . . . . . . . . . . . 295 15.2 introduction this section describes the computer operating properly module (cop, version b), a free-running counter that generates a reset if allowed to overflow. the cop module helps software recover from runaway code. prevent a cop reset by periodically clearing the cop counter. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 292 computer operating properly (cop) motorola computer operating properly (cop) 15.3 functional description figure 15-1 shows the structure of the cop module. figure 15-1. cop block diagram addr. register name bit 7 6 5 4 3 2 1 bit 0 $ffff cop control register (copctl) see page 294. read : low byte of reset vector write: clear cop counter reset : unaffected by reset figure 15-2. cop i/o register summary copctl write cgmxclk reset vector fetch sim reset circuit sim reset status register internal reset sources(1) sim clear bits 12 ? 4 13-bit sim counter clear all bits 6-bit cop counter copd (from config) reset copctl write clear cop module cop counter note: see 7.4.2 active resets from internal sources . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
computer operating properly (cop) i/o signals mc68hc908mr8 ? rev 4.0 technical data motorola computer operating properly (cop) 293 the cop counter is a free-running, 6-bit counter preceded by the 13-bit system integration module (sim) counter. if not cleared by software, the cop counter overflows and generates an asynchronous reset after 2 18 ? 2 4 cgmxclk cycles. with a 4.9152-mhz crystal, the cop timeout period is 53.3 ms. writing any value to location $ffff before overflow occurs clears the cop counter and prevents reset. a cop reset pulls the rst pin low for 32 cgmxclk cycles and sets the cop bit in the sim reset status register (srsr) (see 7.7.4 sim reset status register ). note: place cop clearing instructions in the main program and not in an interrupt subroutine. such an interrupt subroutine could keep the cop from generating a reset even while the main program is not working properly. 15.4 i/o signals this subsection describes the signals shown in figure 15-1 . 15.4.1 cgmxclk cgmxclk is the crystal oscillator output signal. cgmxclk frequency is equal to the crystal frequency. 15.4.2 copctl write writing any value to the cop control register (copctl) (see 15.5 cop control register ) clears the cop counter and clears bits 12 ? 4 of the sim counter. reading the cop control register returns the reset vector. 15.4.3 power-on reset the power-on reset (por) circuit in the sim clears the sim counter 4096 cgmxclk cycles after power-up. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 294 computer operating properly (cop) motorola computer operating properly (cop) 15.4.4 internal reset an internal reset clears the sim counter and the cop counter. 15.4.5 reset vector fetch a reset vector fetch occurs when the vector address appears on the data bus. a reset vector fetch clears the sim counter. 15.4.6 cop disable the cop disable (copd) signal reflects the state of the cop disable bit (copd) in the configuration register (config). see 5.4 config bits . 15.5 cop control register the cop control register (copctl) is located at address $ffff and overlaps the reset vector. writing any value to $ffff clears the cop counter and starts a new timeout period. reading location $ffff returns the low byte of the reset vector. 15.6 interrupts the cop does not generate cpu interrupt requests. ad- dress: $ffff bit 7654321bit 0 read: low byte of reset vector write: clear cop counter reset: unaffected by reset figure 15-3. cop control register (copctl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
computer operating properly (cop) monitor mode mc68hc908mr8 ? rev 4.0 technical data motorola computer operating properly (cop) 295 15.7 monitor mode the cop is disabled in monitor mode when v dd +v hi is present on the irq pin or on the rst pin. 15.8 wait mode the wait instruction puts the mcu in low power-consumption standby mode. the cop continues to operate during wait mode. 15.9 stop mode stop mode turns off the cop prescaler clock. service the cop immediately before entering or after exiting stop mode to ensure a full cop timeout period after entering or exiting stop mode. 15.10 cop module during break mode the cop is disabled during a break interrupt when v dd +v hi is present on the rst pin. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 296 computer operating properly (cop) motorola computer operating properly (cop) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola external interrupt (irq) 297 technical data ? mc68hc908mr8 section 16. external interrupt (irq) 16.1 contents 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 16.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 16.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 16.5 irq pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 16.6 irq module during wait mode . . . . . . . . . . . . . . . . . . . . . . 302 16.7 irq module during stop mode . . . . . . . . . . . . . . . . . . . . . . 302 16.8 irq module during break mode . . . . . . . . . . . . . . . . . . . . . 302 16.9 irq status and control register . . . . . . . . . . . . . . . . . . . . . 303 16.2 introduction this section describes the external interrupt module, which supports external interrupt functions. 16.3 features features of the irq module include:  a dedicated external interrupt pin, irq  hysteresis buffers f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 298 external interrupt (irq) motorola external interrupt (irq) 16.4 functional description a logic 0 applied to any of the external interrupt pins can latch a cpu interrupt request. figure 16-1 shows the structure of the irq module. interrupt signals on the irq pin are latched into the irq latch. an interrupt latch remains set until one of the following actions occurs:  vector fetch ? a vector fetch automatically generates an interrupt acknowledge signal that clears the latch that caused the vector fetch.  software clear ? software can clear an interrupt latch by writing to the appropriate acknowledge bit in the interrupt status and control register (iscr). writing a logic 1 to the ack1 bit clears the irq latch.  reset ? a reset automatically clears both interrupt latches. figure 16-1. irq module block diagram addr. register name bit 7 6 5 4 3 2 1 bit 0 $003f irq status/control register (iscr) see page 303. read: 0 0 0 0 irqf 0 imask 1 mode 1 write:rrrr ack1 reset:00000000 r= reserved figure 16-2. irq i/o register summary ack1 imask1 dq ck clr irq high- interrupt to mode select logic irq latch request irq v dd mode1 voltage detect synchro- nizer f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
external interrupt (irq) functional description mc68hc908mr8 ? rev 4.0 technical data motorola external interrupt (irq) 299 the external interrupt pins are falling-edge-triggered and are software-configurable to be both falling-edge and low-level-triggered. the mode1 bit in the iscr controls the triggering sensitivity of the irq pin. when the interrupt pin is edge-triggered only, the interrupt latch remains set until a vector fetch, software clear, or reset occurs. when the interrupt pin is both falling-edge and low-level-triggered, the interrupt latch remains set until both of these occur:  vector fetch, software clear, or reset  return of the interrupt pin to logic 1 the vector fetch or software clear can occur before or after the interrupt pin returns to logic 1. as long as the pin is low, the interrupt request remains pending. when set, the imask1 bit in the iscr mask all external interrupt requests. a latched interrupt request is not presented to the interrupt priority logic unless the imask bit is clear. note: the interrupt mask (i) in the condition code register (ccr) masks all interrupt requests, including external interrupt requests. see figure 16-3 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 300 external interrupt (irq) motorola external interrupt (irq) figure 16-3. irq interrupt flowchart from reset i bit set? fetch next yes no interrupt? instruction swi instruction? rti instruction? no stack cpu registers no set i bit load pc with interrupt vector no yes unstack cpu registers execute instruction yes yes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
external interrupt (irq) irq pin mc68hc908mr8 ? rev 4.0 technical data motorola external interrupt (irq) 301 16.5 irq pin a logic 0 on the irq pin can latch an interrupt request into the irq latch. a vector fetch, software clear, or reset clears the irq latch. if the mode1 bit is set, the irq pin is both falling-edge-sensitive and low-level-sensitive. with mode1 set, both of these actions must occur to clear the irq latch:  vector fetch, software clear, or reset ? a vector fetch generates an interrupt acknowledge signal to clear the latch. software can generate the interrupt acknowledge signal by writing a logic 1 to the ack1 bit in the interrupt status and control register (iscr). the ack1 bit is useful in applications that poll the irq pin and require software to clear the irq latch. writing to the ack1 bit can also prevent spurious interrupts due to noise. setting ack1 does not affect subsequent transitions on the irq pin. a falling edge that occurs after writing to the ack1 bit latches another interrupt request. if the irq mask bit, imask1, is clear, the cpu loads the program counter with the vector address at locations $fffa and $fffb.  return of the irq pin to logic 1 ? as long as the irq pin is at logic 0, the irq latch remains set. the vector fetch or software clear and the return of the irq pin to logic 1 can occur in any order. the interrupt request remains pending as long as the irq pin is at logic 0. if the mode1 bit is clear, the irq pin is falling-edge-sensitive only. with mode1 clear, a vector fetch or software clear immediately clears the irq latch. use the branch if irq pin high (bih) or branch if irq pin low (bil) instruction to read the logic level on the irq pin. note: when using the level-sensitive interrupt trigger, avoid false interrupts by masking interrupt requests in the interrupt routine. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 302 external interrupt (irq) motorola external interrupt (irq) 16.6 irq module during wait mode the irq module remains active in wait mode. clearing the imask1 bit in the irq status and control register (iscr) enables irq central processor unit (cpu) interrupt requests to bring the microcontroller unit (mcu) out of wait mode. 16.7 irq module during stop mode the irq module remains active in stop mode. clearing the imask1 bit in the irq status and control register (iscr) enables irq cpu interrupt requests to bring the mcu out of stop mode. 16.8 irq module during break mode the system integration (sim) module controls whether the irq interrupt latch can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear the latches during the break state. see 7.7.5 sim break flag control register . to allow software to clear the irq latch during a break interrupt, write a logic 1 to the bcfe bit. if a latch is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the latches during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), writing to the ack1 bit in the irq status and control register during the break state has no effect on the irq latches. see 16.9 irq status and control register . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
external interrupt (irq) irq status and control register mc68hc908mr8 ? rev 4.0 technical data motorola external interrupt (irq) 303 16.9 irq status and control register the irq status and control register (iscr) has these functions:  clears the irq interrupt latch  masks irq interrupt requests  controls triggering sensitivity of the irq interrupt pin ack1 ? irq interrupt request acknowledge bit writing a logic 1 to this write-only bit clears the irq latch. ack1 always reads as logic 0. reset clears ack1. imask1 ? irq interrupt mask bit writing a logic 1 to this read/write bit disables irq interrupt requests. reset clears imask1. 1 = irq interrupt requests disabled 0 = irq interrupt requests enabled mode1 ? irq edge/level select bit this read/write bit controls the triggering sensitivity of the irq pin. reset clears mode1. 1 = irq interrupt requests on falling edges and low levels 0 = irq interrupt requests on falling edges only irqf ? irq flag this read-only bit acts as a status flag, indicating an irq event occurred. 1 = external irq event occurred. 0 = external irq event did not occur. ad- dress: $003f bit 7654321bit 0 read: 0 0 0 0 irqf 0 imask1 mode1 write:rrrr ack1 reset:00000000 r= reserved figure 16-4. irq status and control register (iscr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 304 external interrupt (irq) motorola external interrupt (irq) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola low-voltage inhibit (lvi) 305 technical data ? mc68hc908mr8 section 17. low-voltage inhibit (lvi) 17.1 contents 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 17.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 17.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 17.4.1 polled lvi operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.2 forced reset operation . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.3 false reset protection . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 17.4.4 lvi trip selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 17.5 lvi status and control register . . . . . . . . . . . . . . . . . . . . . 308 17.6 lvi interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 17.7 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 17.8 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 17.2 introduction this section describes the low-voltage inhibit (lvi) module, which monitors the voltage on the v dd pin and can force a reset when the v dd voltage falls to the lvi trip voltage. 17.3 features features of the lvi module include:  programmable lvi reset  programmable power consumption  digital filtering of v dd pin level  selectable lvi trip voltage f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 306 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi) 17.4 functional description figure 17-1 shows the structure of the lvi module. the lvi is enabled out of reset. the lvi module contains a bandgap reference circuit and comparator. the lvi power bit, lvipwr, enables the lvi to monitor v dd voltage. the lvi reset bit, lvirst, enables the lvi module to generate a reset when v dd falls below a voltage, v lvrx , and remains at or below that level for nine or more consecutive cgmxclk.  v lvrx and v lvhx are determined by the trpsel bit in the lvi status and control register (lviscr). see figure 17-2 .  lvipwr and lvirst are in the configuration (config) register. see 5.4 config bits . once an lvi reset occurs, the mcu remains in reset until v dd rises above a voltage, v lvrx + v lvhx . v dd must be above v lvrx + v lvhx for only one central processor unit (cpu) cycle to bring the microcontroller unit (mcu) out of reset. see 7.4.2.5 low-voltage inhibit (lvi) reset . the output of the comparator controls the state of the lviout flag in the lviscr. note: an lvi reset also drives the rst pin low to provide low-voltage protection to external peripheral devices. figure 17-1. lvi module block diagram low v dd lvirst v dd > lvitrip = 0 v dd < lvitrip = 1 lviout lvipwr detector v dd lvi reset from config from config v dd digital filter cpu clock anlgtrip trpsel from lviscr f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage inhibit (lvi) functional description mc68hc908mr8 ? rev 4.0 technical data motorola low-voltage inhibit (lvi) 307 17.4.1 polled lvi operation in applications that can operate at v dd levels below v lvrx , software can monitor v dd by polling the lviout bit. in the configuration register, the lvipwr bit must be at logic 1 to enable the lvi module, and the lvirst bit must be at logic 0 to disable lvi resets. trpsel in the lviscr selects v lvrx . see 5.4 config bits . 17.4.2 forced reset operation in applications that require v dd to remain above v lvrx , enabling lvi resets allows the lvi module to reset the mcu when v dd falls to the v lvrx level and remains at or below that level for nine or more consecutive cpu cycles. in the config register, the lvipwr and lvirst bits must be at logic 1 to enable the lvi module and to enable lvi resets. trpsel in the lviscr selects v lvrx . 17.4.3 false reset protection the v dd pin level is digitally filtered to reduce false resets due to power supply noise. in order for the lvi module to reset the mcu, v dd must remain at or below v lvrx for nine or more consecutive cpu cycles. v dd must be above v lvrx + v lvhx for only one cpu cycle to bring the mcu out of reset. trpsel in the lviscr selects v lvrx + v lvhx . addr. register name bit 7654321bit 0 $fe0f lvi status and control regis- ter (lviscr) see page 308. read : lvi- out 0 trps- el 00000 write : rr rrrrr re- set: 00000000 r=reserved figure 17-2. lvi i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 308 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi) 17.4.4 lvi trip selection the trpsel bit allows the user to choose between 5 percent and 10 percent tolerance when monitoring the supply voltage. the 10 percent option is enabled out of reset. writing a logic 1 to trpsel will enable the 5 percent option. note: the mcu is guaranteed to operate at a minimum supply voltage. the trip point (v lvr1 or v lvr2 ) may be lower than this. 17.5 lvi status and control register the lvi status register flags v dd voltages below the v lvrx level. lviout ? lvi output bit this read-only flag becomes set when the v dd voltage falls below the v lvrx voltage for 32 to 40 cgmxclk cycles. see table 17-1 . reset clears the lviout bit. ad- dress: $fe0f bit 7654321bit 0 read: lviout 0 trps- el 00000 write:rr rrrrr reset:00000000 r=reserved figure 17-3. lvi status and control register (lviscr) table 17-1. lviout bit indication v dd lviout at level: for number of cgmxclk cycles: v dd > v lvrx + v lvhx any 0 v dd < < < f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage inhibit (lvi) lvi interrupts mc68hc908mr8 ? rev 4.0 technical data motorola low-voltage inhibit (lvi) 309 trpsel ? lvi trip select bit this bit selects the lvi trip point. reset clears this bit. 1 = 5 percent tolerance. the trip point and recovery point are determined by v lvr1 and v lvh1 respectively. 0 = 10 percent tolerance. the trip point and recovery point are determined by v lvr2 and v lvh2 respectively. note: if lvipwr and lvirst are at logic 1, note that when changing the tolerance, lvi reset will be generated if the supply voltage is below the trip point. 17.6 lvi interrupts the lvi module does not generate interrupt requests. 17.7 wait mode the wait instruction puts the microcontroller unit (mcu) in low power-consumption standby mode. with the lvipwr bit in the configuration register programmed to logic 1, the lvi module is active after a wait instruction. with the lvirst bit in the configuration register programmed to logic 1, the lvi module can generate a reset and bring the mcu out of wait mode. 17.8 stop mode the stop instruction puts the mcu in low power-consumption standby mode. v lvrx < < f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 310 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi) with the lvipwr bit in the configuration register programmed to logic 1, the lvi module is active after a stop instruction. with the lvirst bit in the configuration register programmed to logic 1, the lvi module can generate a reset and bring the mcu out of stop mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 311 technical data ? mc68hc908mr8 section 18. analog-to-digital converter (adc) 18.1 contents 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 18.4.1 adc port i/o pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 18.4.2 voltage conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 18.4.3 conversion time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 18.4.4 continuous conversion . . . . . . . . . . . . . . . . . . . . . . . . . . 315 18.4.5 result justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 18.4.6 monotonicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 18.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 18.6 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 18.7 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 18.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 18.8.1 adc voltage reference pin (v refh ) . . . . . . . . . . . . . . . . 317 18.8.2 adc voltage in (advin) . . . . . . . . . . . . . . . . . . . . . . . . . . 318 18.8.3 adc external connection . . . . . . . . . . . . . . . . . . . . . . . . 318 18.9 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 18.9.1 adc status and control register . . . . . . . . . . . . . . . . . . 319 18.9.2 adc data register high . . . . . . . . . . . . . . . . . . . . . . . . . 322 18.9.3 adc data register low . . . . . . . . . . . . . . . . . . . . . . . . . . 323 18.9.4 adc clock register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 312 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) 18.2 introduction this section describes the 10-bit analog-to-digital converter (adc). for further information regarding analog-to-digital converters on motorola microcontrollers, please consult the hc08 adc reference manual, adcrm/ad. 18.3 features features of the adc module include:  four to seven channels with multiplexed input  linear successive approximation  10-bit resolution, 8-bit accuracy  single or continuous conversion  conversion complete flag or conversion complete interrupt  selectable adc clock  left or right justified result.  left justified sign data mode  high impedance buffered adc input 18.4 functional description depending on the package option, up to seven adc channels are available for sampling external sources at pins pta6/atd6:pt00/atd0. to achieve the best possible accuracy, these pins are implemented as input-only pins when the analog-to-digital (a/d) feature is enabled. an analog multiplexer allows the single adc to select one of the seven adc channels as adc voltage in (adcvin). adcvin is converted by the successive approximation algorithm. when the conversion is completed, the adc places the result in the adc data register (adrh and adrl) and sets a flag or generates an interrupt. see figure 18-1 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) functional description mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 313 figure 18-1. adc block diagram 18.4.1 adc port i/o pins pta6/atd6:pta0/atd6 are general-purpose input/output (i/o) pins that are shared with the adc channels. the channel select bits define which adc channel/port pin will be used as the input signal. the adc overrides the port logic when that port is selected by the adc multiplexer. the remaining adc channels/port pins are controlled by the port logic and can be used as general-purpose input/output (i/o) pins. writes to the port register or data direction register (ddr) will not have any effect on the port pin that is selected by the adc. read of a port pin which is in use by the adc will return a logic 0. internal data bus read pta ptax channel select adc clock generator conversion complete adc voltage in advin adc clock cgmxclk f op adch6:adch0 adc data registers adiv[2:0] adiclk aien disable adc channel x adc interrupt logic interrupt f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 314 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) 18.4.2 voltage conversion when the input voltage to the adc equals v refh , the adc converts the signal to $3ff (full scale). if the input voltage equals v ss, the adc converts it to $000. input voltages between v refh and v refl are straight-line linear conversions. all other input voltages will result in $3ff if greater than v refh and $000 if less than v ss . note: input voltage should not exceed the analog supply voltages. 18.4.3 conversion time conversion starts after a write to the adc status and control register (adscr). a conversion is between 16 and 17 adc clock cycles, therefore: the adc conversion time is determined by the clock source chosen and the divide ratio selected. the clock source is either the bus clock or cgmxclk and is selectable by adiclk located in the adc clock register. for example, if cgmxclk is 4 mhz and is selected as the adc input clock source, the adc input clock /4 prescale is selected: note: the adc frequency must be between f adic minimum and f adic maximum to meet a/d specifications. since an adc cycle may be comprised of several bus cycles (four in the prior example) and the start of a conversion is initiated by a bus cycle write to the adscr, from zero to four additional bus cycles may occur before the start of the initial adc cycle. this results in a fractional adc cycle and is represented as the 17th cycle. 16 to 17 adc cycles conversion time = adc frequency number of bus cycles = conversion time x bus frequency 16 to 17 adc cycles conversion time = 4 mhz/4 = 16 to 17 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) functional description mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 315 18.4.4 continuous conversion in the continuous conversion mode, the adc data registers (adrh and adrl) will be filled with new data after each conversion. data from the previous conversion will be overwritten whether that data has been read or not. conversions will continue until the adco bit is cleared. the coco bit is set after the first conversion and will stay set for the next several conversions until the next write of the adc status and control register or the next read of the adc data register. 18.4.5 result justification the conversion result may be formatted in four different ways: 1. left justified 2. right justified 3. left justified sign data mode 4. 8-bit truncation mode all four of these modes are controlled using mode0 and mode1 bits located in the adc clock register (adclk). left justification will place the eight most significant bits (msb) in the corresponding adc data register high, adrh. this may be useful if the result is to be treated as an 8-bit result where the two least significant bits (lsb), located in the adc data register low, adrl, can be ignored. however, adrl must be read after adrh or else the interlocking will prevent all new conversions from being stored. right justification will place only the two msbs in the corresponding adc data register high, adrh, and the eight lsbs in adc data register low, adrl. this mode of operation is typically used when a 10-bit unsigned result is desired. left justified sign data mode is similar to left justified mode with one exception. the msb of the 10-bit result, ad9 located in adrh, is complemented. this mode of operation is useful when a result, represented as a signed magnitude from mid-scale, is needed. finally, 8-bit truncation mode will place the eight msbs in adc data register low, adrl. the two lsbs are dropped. this mode of operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 316 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) is used when compatibility with 8-bit adc designs are required. no interlocking between adrh and adrl is present. note: quantization error is affected when only the most significant eight bits are used as a result. see figure 18-2 . figure 18-2. 8-bit truncation mode error 18.4.6 monotonicity the conversion process is monotonic and has no missing codes. 18.5 interrupts when the aien bit is set, the adc module is capable of generating a cpu interrupt after each adc conversion. a cpu interrupt is generated if the coco bit is at logic 0. the coco bit is not used as a conversion complete flag when interrupts are enabled. ideal 10-bit characteristic with quantization = 1/2 i deal8-bit characteristic with quantization = 1/2 10-bit truncated to 8-bit result when truncation is used, error from ideal 8 bit = 3/8 lsb due to non-ideal quantization. 000 001 002 003 004 005 006 007 008 009 00a 00b 000 001 002 003 8-bit result 10-bit result input voltage represented as 10-bit input voltage represented as 8-bit 1/2 2 1/2 4 1/2 6 1/2 8 1/2 1 1/2 3 1/2 5 1/2 7 1/2 9 1/2 1/2 2 1/2 1 1/2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) wait mode mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 317 18.6 wait mode the wait instruction can put the mcu in low power-consumption standby mode. the adc continues normal operation during wait mode. any enabled cpu interrupt request from the adc can bring the mcu out of wait mode. if the adc is not required to bring the mcu out of wait mode, power down the adc by setting adch[4:0] in the adc status and control register before executing the wait instruction. 18.7 stop mode the stop instruction can put the mcu in low power-consumption standby mode. the adc module becomes inactive after the execution of a stop instruction. any pending conversion is aborted. adc conversions resume when the mcu exits stop mode after an external interrupt. allow one conversion cycle to stabilize the analog circuitry after exiting stop mode. 18.8 i/o signals the adc module has seven input signals that are shared with port a. 18.8.1 adc voltage reference pin (v refh ) v refh is the power supply for setting the reference voltage. connect the v refh pin to the same voltage potential as v dda . there will be a finite current associated with v refh . note: route v refh carefully for maximum noise immunity and place bypass capacitors as close as possible to the package. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 318 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) 18.8.2 adc voltage in (advin) advin is the input voltage signal from one of the seven adc channels to the adc module. 18.8.3 adc external connection 18.8.3.1 v refh both ac and dc current are drawn through v refh . the ac current is in the form of current spikes required to supply charge to the capacitor array at each successive approximation step. the dc current flows through the internal resistor string. the best external component to meet both these current demands is a capacitor in the 0.01 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 319 18.9 i/o registers these i/o registers control and monitor operation of the adc:  adc status and control register (adscr)  adc data registers (adrh and ardl)  adc control register (adcr)  adc clock register (adclk) 18.9.1 adc status and control register these paragraphs describe the function of the adc status and control register (adscr). writing adscr aborts the current conversion and initiates a new conversion. coco ? conversions complete bit when aien bit is a logic 0, the coco is a read-only bit which is set each time a conversion is completed except in the continuous conversion mode where it is set after the first conversion. this bit is cleared whenever the adc status and control register is written or whenever the adc data register is read. if aien bit is a logic 1, the coco is a read/write bit which selects the cpu to service the adc interrupt request. reset clears this bit. 1 = conversion completed (aien = 0) interrupt (aien = 1) 0 = conversion not completed (aien = 0)/cpu interrupt (aien = 1) ad- dress: $0040 bit 7654321bit 0 read: coco aien adco adch4 adch3 adch2 adch1 adch0 write: reset:00011111 figure 18-3. adc status and control register (adscr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 320 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) aien ? adc interrupt enable bit when this bit is set, an interrupt is generated at the end of an adc conversion. the interrupt signal is cleared when the data register is read or the status/control register is written. reset clears the aien bit. 1 = adc interrupt enabled 0 = adc interrupt disabled adco ? adc continuous conversion bit when set, the adc will convert samples continuously and update the adr register at the end of each conversion. only one conversion is allowed when this bit is cleared. reset clears the adco bit. 1 = continuous adc conversion 0 = one adc conversion adch[4:0] ? adc channel select bits adch4, adch3, adch2, adch1, and adch0 form a 5-bit field which is used to select one of the adc channels detailed in table 18-1 . take care to prevent switching noise from corrupting the analog signal when simultaneously using a port pin as both an analog and digital input. the adc subsystem is turned off when the channel select bits are all set to 1. this feature allows for reduced power consumption for the mcu when the adc is not used. note: recovery from the disabled state requires one conversion cycle to stabilize. the voltage levels supplied from internal reference nodes as specified in table 18-1 are used to verify the operation of the adc converter both in production test and for user applications. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 321 table 18-1. mux channel select adch4 adch3 adch2 adch1 adch0 input select 00000 pta0 00001 pta1 00010 pta2 00011 pta3 00100 pta4 00101 pta5 00110 pta6 0 0 1 1 1 unused* 0 1 0 0 0 unused* 0 1 0 0 1 unused* 0 1 0 1 0 unused* 01011 ? 01100 ? 01101 ? 01110 ? 01111 ? 10000 ? 1 1 0 1 0 unused* 1 1 0 1 1 reserved** 1 1 1 0 0 unused* 1 1 1 0 1 v refh 1 1 1 1 0 v ss 1 1 1 1 1 adc power off * if any unused channels are selected, the resulting adc conversion will be unknown. ** used for factory testing. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 322 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) 18.9.2 adc data register high in left justified mode, this 8-bit result register holds the eight msbs of the 10-bit result. this register is updated each time an adc single channel conversion completes. reading adrh latches the contents of adrl until adrl is read. until adrl is read, all subsequent adc results will be lost. in right justified mode, this 8-bit result register holds the two msbs of the 10-bit result. all other bits read as 0. this register is updated each time a single channel adc conversion completes. reading adrh latches the contents of adrl until adrl is read. until adrl is read, all subsequent adc results will be lost. ad- dress: $0041 bit 7654321bit 0 read: ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 write:rrrrrrrr reset: unaffected by reset r= reserved figure 18-4. adc data register high (adrh) left justified mode ad- dress: $0041 bit 7654321bit 0 read:000000ad9ad8 write:rrrrrrrr reset: unaffected by reset r= reserved figure 18-5. adc data register high (adrh) right justified mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 323 18.9.3 adc data register low in left justified mode, this 8-bit result register holds the two lsbs of the 10-bit result. all other bits read as 0. this register is updated each time a single channel adc conversion completes. reading adrh latches the contents of adrl until adrl is read. until adrl is read all subsequent adc results will be lost. in right justified mode, this 8-bit result register holds the eight lsbs of the 10-bit result. this register is updated each time an adc conversion completes. reading adrh latches the contents of adrl until adrl is read. until adrl is read all subsequent adc results will be lost. ad- dress: $0042 bit 7654321bit 0 read:ad1ad0000000 write:rrrrrrrr reset: unaffected by reset r= reserved figure 18-6. adc data register low (adrl) left justified mode ad- dress: $0042 bit 7654321bit 0 read: ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 write:rrrrrrrr reset: unaffected by reset r= reserved figure 18-7. adc data register low (adrl) right justified mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 324 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) in 8-bit mode, this 8-bit result register holds the eight msbs of the 10-bit result. this register is updated each time an adc conversion completes. in 8-bit mode, this register contains no interlocking with adrh. 18.9.4 adc clock register this register selects the clock frequency for the adc, selecting between modes of operation. adiv2:adiv0 ? adc clock prescaler bits adiv2, adiv1, and adiv0 form a 3-bit field which selects the divide ratio used by the adc to generate the internal adc clock. table 18-2 shows the available clock configurations. the adc clock should be set to between 500 khz and 1 mhz. ad- dress: $0042 bit 7654321bit 0 read: ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 write:rrrrrrrr reset: unaffected by reset r= reserved figure 18-8. adc data register low (adrl) 8-bit mode ad- dress: $0043 bit 7654321bit 0 read: adiv2 adiv1 adiv0 adiclk mode1 mode0 0 0 write: r reset:00000100 r= reserved figure 18-9. adc clock register (adclk) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog-to-digital converter (adc) i/o registers mc68hc908mr8 ? rev 4.0 technical data motorola analog-to-digital converter (adc) 325 adiclk ? adc input clock select bit adiclk selects either bus clock or cgmxclk as the input clock source to generate the internal adc clock. reset selects cgmxclk as the adc clock source. if the external clock (cgmxclk) is equal or greater than 1 mhz, cgmxclk can be used as the clock source for the adc. if cgmxclk is less than 1 mhz, use the pll-generated bus clock as the clock source. as long as the internal adc clock is at f adic , correct operation can be guaranteed. 1 = internal bus clock 0 = external clock, cgmxclk mode1:mode0 ? modes of result justification bits mode1:mode0 selects among four modes of operation. the manner in which the adc conversion results will be placed in the adc data registers is controlled by these modes of operation. reset returns right-justified mode. 00 = 8-bit truncation mode 01 = right justified mode 10 = left justified mode 11 = left justified sign data mode table 18-2. adc clock divide ratio adiv2 adiv1 adiv0 adc clock rate 0 0 0 adc input clock /1 0 0 1 adc input clock /2 0 1 0 adc input clock /4 0 1 1 adc input clock /8 1 x x adc input clock /16 x = don ? t care cgmxclk or bus frequency f adic = adiv[2:0] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 326 analog-to-digital converter (adc) motorola analog-to-digital converter (adc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola power-on reset (por) 327 technical data ? mc68hc908mr8 section 19. power-on reset (por) 19.1 contents 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 19.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 19.2 introduction this section describes the power-on reset (por) module. 19.3 functional description the por module provides a known, stable signal to the mcu at power-on. this signal tracks v dd until the mcu generates a feedback signal to indicate that it is properly initialized. at this time, the por drives its output low. the por is not a brown-out detector, low-voltage detector, or glitch detector. v dd at the por must go completely to 0 to reset the mcu. to detect power-loss conditions, use a low-voltage inhibit module (lvi) or other suitable circuit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 328 power-on reset (por) motorola power-on reset (por) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola break (brk) 329 technical data ? mc68hc908mr8 section 20. break (brk) 20.1 contents 20.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 20.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 20.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 20.4.1 flag protection during break interrupts . . . . . . . . . . . . 330 20.4.2 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . 332 20.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . 332 20.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . 332 20.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 20.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 20.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 20.6 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 20.6.1 break status and control register . . . . . . . . . . . . . . . . . 333 20.6.2 break address registers . . . . . . . . . . . . . . . . . . . . . . . . . 334 20.6.3 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . 336 20.6.4 sim break flag control register . . . . . . . . . . . . . . . . . . 337 20.2 introduction this section describes the break (brk) module. the break module can generate a break interrupt that stops normal program flow at a defined address to enter a background program. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 330 break (brk) motorola break (brk) 20.3 features features of the break module include:  accessible input/output (i/o) registers during the break interrupt  central processor unit (cpu) generated break interrupts  software-generated break interrupts  computer operating properly (cop) disabling during break interrupts 20.4 functional description when the internal address bus matches the value written in the break address registers, the break module issues a breakpoint signal to the cpu. the cpu then loads the instruction register with a software interrupt instruction (swi) after completion of the current cpu instruction. the program counter vectors to $fffc and $fffd ($fefc and $fefd in monitor mode). these events can cause a break interrupt to occur:  a cpu-generated address (the address in the program counter) matches the contents of the break address registers.  software writes a logic 1 to the brka bit in the break status and control register. when a cpu-generated address matches the contents of the break address registers, the break interrupt begins after the cpu completes its current instruction. a return-from-interrupt instruction (rti) in the break routine ends the break interrupt and returns the microcontroller unit (mcu) to normal operation. figure 20-1 shows the structure of the break module. 20.4.1 flag protection during break interrupts the bcfe bit in the system integration module (sim) break flag control register (sbfcr) enables software to clear status bits during the break state. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
break (brk) functional description mc68hc908mr8 ? rev 4.0 technical data motorola break (brk) 331 figure 20-1. break module block diagram iab15 ? iab8 iab7 ? iab0 8-bit comparator 8-bit comparator control break address register low break address register high iab15 ? iab0 break addr.register name bit 7654321bit 0 $fe0 0 sim break status register (sbsr) see page 336. read : 000100bw0 write : rrrrrrnoter re- set: 00010000 $fe0 3 sim break flag con- trol register (sbfcr) see page 337. read : bcferrrrrrr write : re- set: 0 $fe0 c break address regis- ter high (brkh) see page 334. read : bit 15 14 13 12 11 10 9 bit 8 write : re- set: 00000000 figure 20-2. i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 332 break (brk) motorola break (brk) 20.4.2 cpu during break interrupts the cpu starts a break interrupt by:  loading the instruction register with the swi instruction  loading the program counter with $fffc and $fffd ($fefc and $fefd in monitor mode) the break interrupt begins after completion of the cpu instruction in progress. if the break address register match occurs on the last cycle of a cpu instruction, the break interrupt begins immediately. 20.4.3 tim during break interrupts a break interrupt stops the timer counters. 20.4.4 cop during break interrupts the cop is disabled during a break interrupt when v tst is present on the rst pin. $fe0 d break address regis- ter low (brkl) see page 334. read : bit 7654321bit 0 write : re- set: 00000000 $fe0 e break status and control register (brkscr) see page 333. read : brke brka 000000 write : re- set: 00000000 note: writing a logic 0 clears bw. = unimplemented r = reserved figure 20-2. i/o register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
break (brk) low-power modes mc68hc908mr8 ? rev 4.0 technical data motorola break (brk) 333 20.5 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 20.5.1 wait mode if enabled, the break module is active in wait mode. in the break routine, the user can subtract one from the return address on the stack if sbsw is set. clear the bw bit by writing logic 0 to it. 20.5.2 stop mode a break interrupt causes exit from stop mode and sets the sbsw bit in the break status register. 20.6 break module registers these registers control and monitor operation of the break module:  break status and control register (brkscr)  break address register high (brkh)  break address register low (brkl)  sim break status register (sbsr)  sim break flag control register (sbfcr) 20.6.1 break status and control register the break status and control register (brkscr) contains break module enable and status bits. ad- dress: $fe0e bit 7654321bit 0 figure 20-3. break status and control register (brkscr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 334 break (brk) motorola break (brk) brke ? break enable bit this read/write bit enables breaks on break address register matches. clear brke by writing a logic 0 to bit 7. reset clears the brke bit. 1 = breaks enabled on 16-bit address match 0 = breaks disabled on 16-bit address match brka ? break active bit this read/write status and control bit is set when a break address match occurs. writing a logic 1 to brka generates a break interrupt. clear brka by writing a logic 0 to it before exiting the break routine. reset clears the brka bit. 1 = when read, break address match 0 = when read, no break address match 20.6.2 break address registers the break address registers (brkh and brkl) contain the high and low bytes of the desired breakpoint address. reset clears the break address registers. read: brke brka 000000 write: reset:00000000 = unimplement- ed figure 20-3. break status and control register (brkscr) ad- dress: $fe0c bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 figure 20-4. break address register high (brkh) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
break (brk) break module registers mc68hc908mr8 ? rev 4.0 technical data motorola break (brk) 335 ad- dress: $fe0d bit 7654321bit 0 read: bit 7654321bit 0 write: reset:00000000 figure 20-5. break address register low (brkl) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 336 break (brk) motorola break (brk) 20.6.3 sim break status register the sim break status register (sbsr) contains a flag to indicate that a break caused an exit from wait mode. the flag is useful in applications requiring a return to wait mode after exiting from a break interrupt. bw ? break wait bit this read/write bit is set when a break interrupt causes an exit from wait mode. clear bw by writing a logic 0 to it. reset clears bw. 1 = break interrupt during wait mode 0 = no break interrupt during wait mode bw can be read within the break interrupt routine. the user can modify the return address on the stack by subtracting 1 from it. the example code shown in figure 20-7 works if the h register was stacked in the break interrupt routine. execute this code at the end of the break interrupt routine. ad- dress: $fe00 bit 7654321bit 0 read:000100bw0 write:rrrrrrnoter reset:00010000 note: writing a logic 0 clears bw. r = reserved figure 20-6. sim break status register (sbsr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
break (brk) break module registers mc68hc908mr8 ? rev 4.0 technical data motorola break (brk) 337 figure 20-7. example code 20.6.4 sim break flag control register the sim break flag control register (sbfcr) contains a bit that enables software to clear status bits while the mcu is in a break state. bcfe ? break clear flag enable bit this read/write bit enables software to clear status bits by accessing status registers while the mcu is in a break state. to clear status bits during the break state, the bcfe bit must be set. 1 = status bits clearable during break 0 = status bits not clearable during break hibyte equ 5 lobyte equ 6 ; if not bw, do rti brclr bw,bsr, return ; see if wait mode or stop ; mode was exited by break. tst lobyte,sp ; if returnlo is not 0, bne dolo ; then just decrement low byte. dec hibyte,sp ; else deal with high byte also. dolo dec lobyte,sp ; point to wait/stop opcode. return pulh rti ; restore h register. ad- dress: $fe03 bit 7654321bit 0 read: bcferrrrrrr write: reset: 0 r= reserved figure 20-8. sim break flag control register (sbfcr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 338 break (brk) motorola break (brk) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 339 technical data ? mc68hc908mr8 section 21. electrical specifications 21.1 contents 21.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 21.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . 340 21.4 functional operating range . . . . . . . . . . . . . . . . . . . . . . . . 341 21.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 21.6 dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . 343 21.7 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 21.8 control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 21.9 timer interface module characteristics . . . . . . . . . . . . . . . 346 21.10 clock generation module component specifications . . . 347 21.11 cgm operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . 347 21.12 cgm acquisition/lock time specifications . . . . . . . . . . . . 348 21.13 analog-to-digital converter (adc) characteristics . . . . . . 349 21.2 introduction this section contains electrical and timing specifications. these values are design targets and have not yet been fully characterized. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 340 electrical specifications motorola electrical specifications 21.3 absolute maximum ratings maximum ratings are the extreme limits to which the mcu can be exposed without permanently damaging it. note: this device is not guaranteed to operate properly at the maximum ratings. refer to 21.6 dc electrical characteristics for guaranteed operating conditions. note: this device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum-rated voltages to this high-impedance circuit. for proper operation, it is recommended that v in and v out be constrained to the range v ss ? 0.3 to +6.0 v input voltage v in v ss ? 0.3 to v dd + 0.3 v input high voltage v hi v dd + 4 v maximum current per pin excluding v dd and v ss i ? 55 to +150 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical specifications functional operating range mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 341 21.4 functional operating range characteristic symbol value unit operating temperature range (1) mc68hc908mr8cp mc68hc908mr8cfa mc68hc908mr8cdw mc68hc908mr8vfa mc68hc908mr8vp MC68HC908MR8VDW mc68hc908mr8mfa mc68hc908mr8mp mc68hc908mr8mdw 1. contact a motorola representative for temperature availability. c = extended temperature range ( ? 40 to +85 ? 40 to +105 ? 40 to +125 ? 40 to +85 ? 40 to +85 ? 40 to +85 ? 40 to +105 ? 40 to +105 ? 40 to +105 ? 40 to +125 ? 40 to +125 ? 40 to +125 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 342 electrical specifications motorola electrical specifications 21.5 thermal characteristics characteristic symbol value unit thermal resistance 32-pin lqfp 28-pin pdip 28-pin soic ? ? 1. 32-pin lqfp resistance measured at 200 ft/min. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical specifications dc electrical characteristics mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 343 21.6 dc electrical characteristics characteristic (1) symbol min typ (2) max unit output high voltage i load = ? 2.0 ma for all i/o pins except: port a bits 0 and 1 port b bits 5 and 6 i load = ? 7.0 ma for: port a bits 0 and 1 and port b bits 5 ? 6, a maximum of four 15-ma outputs may be active at any time v oh v dd ? 0.8 v dd ? 1.0 ?? v output low voltage i load = 1.6 ma for all i/o pins except: port a bits 0 and 1 port b bits 5 and 6 i load = 15 ma for: port a bits 0 and 1 and port b bits 5 ? 6, a maximum of four 15-ma outputs may be active at any time v ol ? ? ? ? 0.4 1.5 v input high voltage all ports, irqs, reset , osc1 v ih 0.7 x v dd ? v dd v input low voltage all ports, irqs, reset , osc1 v il v ss ? 0.3 x v dd v v dd supply current run (3) wait (4) stop (5) up to 85 ? ? ? ? ? ? ? ? ? ? ? ? 40 12 5 15 350 100 ma ma ?? ?? ? ? ? ? 12 8 pf low-voltage inhibit falling v lvrf1 4.0 4.4 ? v low-voltage reset/recover hysteresis v lvh1 20 50 ? mv low-voltage recover rising v lvrr1 ? 4.5 4.75 v f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 344 electrical specifications motorola electrical specifications ? continued low-voltage inhibit falling v lvrf2 3.8 4.1 ? v low-voltage reset/recover hysteresis v lvh2 50 100 ? mv low-voltage recover rising v lvrr2 ? 4.2 4.6 v por re-arm voltage (6) v por 0 ? 100 mv por rise time ramp rate (7) r por 0.035 ?? v/ms 1. v dd = 5.0 vdc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical specifications memory characteristics mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 345 21.7 memory characteristics characteristic symbol min typ max unit ram data retention voltage v rdr 1.3 ?? v flash program bus clock frequency ? 1 ?? mhz flash read bus clock frequency f read (1) 1. f read is defined as the frequency range for which the flash memory can be read. 32k ? 8.4m hz flash page erase time t erase (2) 2. if the page erase time is longer than t erase (min), there is no erase-disturb, but it reduces the endurance of the flash memory. 1 ?? ms flash mass erase time t merase (3) 3. if the mass erase time is longer than t merase (min), there is no erase-disturb, but it reduces the endurance of the flash memory. 4 ?? ms flash pgm/erase to hven set up time t nvs 10 ?? ?? ?? ?? ? 40 ?? ?? 4ms flash row erase endurance (6) 6. the minimum row endurance value specifies each row of the flash memory is guaranteed to work for at least this many erase / program cycles. ? 10k 100k (7) 7. flash endurance is a function of the temperature at which erasure occurs. typical endurance degrades when the tem- perature while erasing is less than 25 ? cycles flash row program endurance (8) 8. the minimum row endurance value specifies each row of the flash memory is guaranteed to work for at least this many erase / program cycles. ? 10k 100k (7) ? cycles flash data retention time (9) 9. the flash is guaranteed to retain data over the entire operating temperature range for at least the minimum time specified. ? 10 100 (10) 10. motorola performs reliability testing for data retention. these tests are based on samples tested at elevated temperatures. due to the higher activation energy of the elevated test temperature, calculated life tests correspond to more than 100 years of operation/storage at 55 ? years notes: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 346 electrical specifications motorola electrical specifications 21.8 control timing 21.9 timer interface module characteristics characteristic (1) 1. v dd = 5.0 vdc 10%; v ss = 0 vdc; timing shown with respect to 20% v dd and 70% v dd , unless otherwise noted symbol min max unit frequency of operation (2) crystal option external clock option (3) 2. see 21.8 control timing for more information. 3. no more than 10 percent duty cycle deviation from 50 percent. f osc 1 dc (4) 4. some modules may require a minimum frequency greater than dc for proper operation; see appropriate table for this infor- mation. 8 32.8 mhz internal operating frequency f op ? 8.2 mhz reset input pulse width low (5) 5. minimum pulse width reset is guaranteed to be recognized. it is possible for a smaller pulse width to cause reset. t irl 50 ? ns characteristic symbol min max unit input capture pulse width t tih t til 125 ? ns input clock pulse width t tch t tcl (1/f op ) + 5 ? ns f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical specifications clock generation module component specifications mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 347 21.10 clock generation module component specifications 21.11 cgm operating conditions characteristic symbol min typ max notes crystal load capacitance c l ??? consult crystal manufacturing data crystal fixed capacitance c 1 ? 2 * c l ? consult crystal manufacturing data crystal tuning capacitance c 2 ? 2 * c l ? consult crystal manufacturing data feedback bias resistor r b ? 22 m ? ? series resistor r s 0 330 k ? ? ? c fact * (v dda /f xclk ) ?? bypass capacitor c byp ? 0.1 ? c byp must provide low ac impedance from f = f xclk /100 to 100 * f vclk , so series resistance must be considered. characteristic symbol min typ max crystal reference frequency f xclk 1 mhz ? 8 mhz range nominal multiplier f nom ? 4.9152 mhz ? vco center-of-range frequency f vrs 4.9152 mhz ? 32.8 mhz vco frequency multiplier n 1 ? 15 vco center of range multiplier l 1 ? 15 vco operating frequency f vclk f vrsmin ? f vrsmax f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 348 electrical specifications motorola electrical specifications 21.12 cgm acquisition/lock time specifications description symbol min typ max notes filter capacitor multiply factor c fact ? 0.0154 ? f/sv acquisition mode time factor k acq ? 0.1135 ? v tracking mode time factor k trk ? 0.0174 ? v manual mode time to stable t acq ? (8 * v dda )/ (f xclk * k acq) ? if c f chosen correctly manual stable to lock time t al ? (4 * v dda )/ (f xclk * k trk ) ? if c f chosen correctly manual acquisition time t lock ? t acq + t al ?? tracking mode entry frequency tolerance ? ? 3.6% ? acquisition mode entry frequency tolerance ? ? 7.2% ? lock entry frequency tolerance ? ? 0.9% ? lock exit frequency tolerance ? ? 1.8% ? reference cycles per acquisition mode measurement n acq ? 32 ?? reference cycles per tracking mode measurement n trk ? 128 ?? automatic mode time to stable t acq n acq /f xclk (8 * v dda )/ (f xclk * k acq) ? if c f chosen correctly automatic stable to lock time t al n trk /f xclk (4 * v dda )/ (f xclk * k trk ) ? if c f chosen correctly automatic lock time t lock ? t acq + t al ?? pll jitter (deviation of average bus frequency over 2 ms) f j 0 ? (f crys ) * (0.025 %) * (n/4) n = vco freq. mult. (gbnt) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical specifications analog-to-digital converter (adc) characteristics mc68hc908mr8 ? rev 4.0 technical data motorola electrical specifications 349 21.13 analog-to-digital converter (adc) characteristics characteristic symbol min typ max unit notes a/d reference voltage v refh 4.5 ? 5.5 v ? input voltages v adin 0 ? v refh v v adin <= v refh resolution b ad 10 ? 10 bits ? absolute accuracy a ad ?? 4 counts includes quantization adc internal clock f adic 500 k ? 1 m hz t aic = 1/f adic conversion range r ad v ssa ? v refh v ? power-up time t adpu 16 ? t aic cycles ? conversion time t adc 16 ? 17 t aic cycles ? sample time t ads 5 ?? t aic cycles ? monotonicity m ad guaranteed zero input reading z adi 000 ? 003 hex v adin = v ssa full-scale reading f adi 3fd ? 3ff hex v adin = v refh input capacitance c adi ?? 30 pf not characterized absolute accuracy (8-bit truncation mode) a ad ?? ??? +7/8 ? 1/8 lsb ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 350 electrical specifications motorola electrical specifications f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola mechanical specifications 351 technical data ? mc68hc908mr8 section 22. mechanical specifications 22.1 contents 22.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 22.3 32-pin lqfp (case #873a) . . . . . . . . . . . . . . . . . . . . . . . . . . 352 22.4 28-pin pdip (case #710) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 22.5 28-pin soic (case #751f) . . . . . . . . . . . . . . . . . . . . . . . . . . 353 22.2 introduction the mc68hc908mr8 is available in these packages:  32-pin low-profile quad flat pack (lqfp)  28-pin dual in-line package (pdip)  28-pin small outline package (soic) the package information contained in this section is the latest available at the time of this publication. to make sure that you have the latest package specifications, contact one of the following:  local motorola sales office  world wide web at http://www.motorola.com/semiconductors/ follow world wide web on-line instructions to retrieve the current mechanical specifications. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 352 mechanical specifications motorola mechanical specifications 22.3 32-pin lqfp (case #873a) detail y a s1 v b 1 8 9 17 25 32 ae ae p detail y base n j d f metal section ae ? ae g seating plane r q  w k x 0.250 (0.010) gauge plane e c h detail ad notes: 1. dimensioning and tolerancing per ansi y14.5m, 1982. 2. controlling dimension: millimeter. 3. datum plane ? ab ? is located at bottom of lead and is coincident with the lead where the lead exits the plastic body at the bottom of the parting line. 4. datums ? t ? , ? u ? , and ? z ? to be determined at datum plane ? ab ? . 5. dimensions s and v to be determined at seating plane ? ac ? . 6. dimensions a and b do not include mold protrusion. allowable protrusion is 0.250 (0.010) per side. dimensions a and b do include mold mismatch and are determined at datum plane ? ab ? . 7. dimension d does not include dambar protrusion. dambar protrusion shall not cause the d dimension to exceed 0.520 (0.020). 8. minimum solder plate thickness shall be 0.0076 (0.0003). 9. exact shape of each corner may vary from depiction. dim a min max min max inches 7.000 bsc 0.276 bsc millimeters b 7.000 bsc 0.276 bsc c 1.400 1.600 0.055 0.063 d 0.300 0.450 0.012 0.018 e 1.350 1.450 0.053 0.057 f 0.300 0.400 0.012 0.016 g 0.800 bsc 0.031 bsc h 0.050 0.150 0.002 0.006 j 0.090 0.200 0.004 0.008 k 0.500 0.700 0.020 0.028 m 12 ref 12 ref n 0.090 0.160 0.004 0.006 p 0.400 bsc 0.016 bsc q 1 5 1 5 r 0.150 0.250 0.006 0.010 v 9.000 bsc 0.354 bsc v1 4.500 bsc 0.177 bsc   detail ad a1 b1 v1 4x s 4x b1 3.500 bsc 0.138 bsc a1 3.500 bsc 0.138 bsc s 9.000 bsc 0.354 bsc s1 4.500 bsc 0.177 bsc w 0.200 ref 0.008 ref x 1.000 ref 0.039 ref 9 ? t ? ? z ? ? u ? t ? u 0.20 (0.008) z ac t ? u 0.20 (0.008) z ab 0.10 (0.004) ac ? ac ? ? ab ? m  8x ? t ? , ? u ? , ? z ? t ? u m 0.20 (0.008) z ac f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mechanical specifications 28-pin pdip (case #710) mc68hc908mr8 ? rev 4.0 technical data motorola mechanical specifications 353 22.4 28-pin pdip (case #710) 22.5 28-pin soic (case #751f)     
  
     
 
 
   
           
         
  

  

      
          
                       !"!#! !     $      !       !   !    # !  114 15 28 b a c n k m j d
  f hg l     
 
           
   
         
             
         
     
         !$  $   %
 !    $ ! !!  !      # ! #
 !"!#! ! #      !    # ! #  ! #        "   !  !"!#! !  -a- -b- 114 15 28 -t- c
      ! ! m j -t- k 26x g 28x d 14x p r x 45       !   f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 354 mechanical specifications motorola mechanical specifications f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola ordering information 355 technical data ? mc68hc908mr8 section 23. ordering information 23.1 contents 23.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 23.3 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 23.2 introduction this section contains instructions for ordering the mc68hc908mr8. 23.3 mc order numbers table 23-1. mc order numbers mc order number (1) 1. fa = quad flat pack p = plastic dual in line package dw = small outline integrated circuit (soic) package operating temperature range ( ? 40 to + 85 ? 40 to + 85 ? 40 to + 85 ? 40 to + 105 ? 40 to + 105 ? 40 to + 105 ? 40 to + 125 ? 40 to + 125 ? 40 to + 125 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 356 ordering information motorola ordering information f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola revision history 357 technical data ? mc68hc908mr8 revision history contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 changes from rev 3.0 published in april 2002 to rev 4.0 published in july 2002 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 introduction this section contains the revision history for the mc68hc908mr8 advance information data book. changes from rev 3.0 published in april 2002 to rev 4.0 published in july 2002 section page (in rev 0.4) description of change electrical specifications 343 v ol max updated for i load = 15 ma stop i dd limits updated for different temperature specs f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
revision history technical data mc68hc908mr8 ? rev 4.0 358 revision history motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68hc908mr8 ? rev 4.0 technical data motorola glossary 359 technical data ? mc68hc908mr8 glossary a ? see accumulator (a). accumulator (a) ? an 8-bit general-purpose register in the cpu08. the cpu08 uses the accumulator to hold operands and results of arithmetic and logic operations. acquisition mode ? a mode of pll operation during startup before the pll locks on a frequency. also see tracking mode. address bus ? the set of wires that the cpu or dma uses to read and write memory locations. addressing mode ? the way that the cpu determines the operand address for an instruction. the m68hc08 cpu has 16 addressing modes. alu ? see arithmetic logic unit (alu). arithmetic logic unit (alu) ? the portion of the cpu that contains the logic circuitry to perform arithmetic, logic, and manipulation operations on operands. asynchronous ? refers to logic circuits and operations that are not synchronized by a common reference signal baud rate ? the total number of bits transmitted per unit of time. bcd ? see binary-coded decimal (bcd) binary ? relating to the base 2 number system binary number system ? the base 2 number system, having two digits, 0 and 1. binary arithmetic is convenient in digital circuit design because digital circuits have two permissible voltage levels, low and high. the binary digits 0 and 1 can be interpreted to correspond to the two digital voltage levels. binary-coded decimal (bcd) ? a notation that uses 4-bit binary numbers to represent the 10 decimal digits and that retains the same positional structure of a decimal number. for example, 234 (decimal) = 0010 0011 0100 (bcd) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 360 glossary motorola glossary bit ? a binary digit. a bit has a value of either logic 0 or logic 1. branch instruction ? an instruction that causes the cpu to continue processing at a memory location other than the next sequential address. break module ? a module in the m68hc08 family. the break module allows software to halt program execution at a programmable point to enter a background routine. breakpoint ? a number written into the break address registers of the break module. when a number appears on the internal address bus that is the same as the number in the break address registers, the cpu executes the software interrupt instruction (swi). break interrupt ? a software interrupt caused by the appearance on the internal address bus of the same value that is written in the break address registers. bus ? a set of wires that transfers logic signals. bus clocks ? there are two bus clocks, it12 and it23. these clocks are generated by the cgm and distributed throughout the mcu by the sim. the frequency of the bus clocks, or operating frequency, is f op . while the frequency of these two clocks is the same, the phase is different. byte ? a set of eight bits. c ? the carry/borrow bit in the condition code register. the cpu08 sets the carry/borrow bit when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. some logical operations and data manipulation instructions also clear or set the carry/borrow bit (as in bit test and branch instructions and shifts and rotates). ccr ? see condition code register. central processor unit (cpu) ? the primary functioning unit of any computer system. the cpu controls the execution of instructions. cgm ? see clock generator module (cgm). clear ? to change a bit from logic 1 to logic 0; the opposite of set. clock ? a square wave signal used to synchronize events in a computer. clock generator module (cgm) ? a module in the m68hc08 family. the cgm generates a base clock signal from which the system clocks are derived. the cgm may include a crystal oscillator circuit and/or phase-locked loop (pll) circuit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc68hc908mr8 ? rev 4.0 technical data motorola glossary 361 comparator ? a device that compares the magnitude of two inputs. a digital comparator defines the equality or relative differences between two binary numbers. computer operating properly module (cop) ? a counter module in the m68hc08 family that resets the mcu if allowed to overflow. condition code register (ccr) ? an 8-bit register in the cpu08 that contains the interrupt mask bit and five bits that indicate the results of the instruction just executed. control bit ? one bit of a register manipulated by software to control the operation of the module. control unit ? one of two major units of the cpu. the control unit contains logic functions that synchronize the machine and direct various operations. the control unit decodes instructions and generates the internal control signals that perform the requested operations. the outputs of the control unit drive the execution unit, which contains the arithmetic logic unit (alu), cpu registers, and bus interface. cop ? see computer operating properly module (cop). counter clock ? the input clock to the tim counter. this clock is an output of the prescaler sub-module. the frequency of the counter clock is f tcnt , and the period is t tcnt . cpu ? see central processor unit (cpu). cpu08 ? the central processor unit of the m68hc08 family. cpu cycles ? a cpu clock cycle is one period of the internal bus-rate clock, f op , normally derived by dividing a crystal oscillator source by two or more so the high and low times will be equal. the length of time required to execute an instruction is measured in cpu clock cycles. cpu registers ? memory locations that are wired directly into the cpu logic instead of being part of the addressable memory map. the cpu always has direct access to the information in these registers. the cpu registers in an m68hc08 are:  a, 8-bit accumulator  h:x, 16-bit index register  sp, 16-bit stack pointer  pc, 16-bit program counter  ccr, condition code register containing the v, h, i, n, z, and c bits f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 362 glossary motorola glossary csic ? customer-specified integrated circuit cycle time ? the period of the operating frequency: t cyc = 1/fop. decimal number system ? base 10 numbering system that uses the digits zero through nine. direct memory access module (dma) ? a m68hc08 family module that can perform data transfers between any two cpu-addressable locations without cpu intervention. for transmitting or receiving blocks of data to or from peripherals, dma transfers are faster and more code-efficient than cpu interrupts. dma ? see direct memory access module (dma). dma service request ? a signal from a peripheral to the dma module that enables the dma module to transfer data. duty cycle ? a ratio of the amount of time the signal is on versus the time it is off. duty cycle is usually represented by a percentage. eeprom ? electrically erasable, programmable, read-only memory. a non-volatile type of memory that can be electrically reprogrammed. eprom ? erasable, programmable, read-only memory. a non-volatile type of memory that can be erased by exposure to an ultraviolet light source and then reprogrammed. exception ? an event such as an interrupt or a reset that stops the sequential execution of the instructions in the main program. external interrupt module (irq) ? a module in the m68hc08 family with both dedicated external interrupt pins and port pins that can be enabled as interrupt pins. fetch ? to copy data from a memory location into the accumulator. firmware ? instructions and data programmed into non-volatile memory. free-running counter ? a device that counts from zero to a predetermined number, then rolls over to zero and begins counting again. full-duplex transmission ? communication on a channel in which data can be sent and received simultaneously. h ? the upper byte of the 16-bit index register (h:x) in the cpu08. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc68hc908mr8 ? rev 4.0 technical data motorola glossary 363 h ? the half-carry bit in the condition code register of the cpu08. this bit indicates a carry from the low-order four bits of the accumulator value to the high-order four bits. the half-carry bit is required for binary-coded decimal arithmetic operations. the decimal adjust accumulator (daa) instruction uses the state of the h and c bits to determine the appropriate correction factor. hexadecimal ? base 16 numbering system that uses the digits 0 through 9 and the letters a through f. high byte ? the most significant eight bits of a word. illegal address ? an address not within the memory map. illegal opcode ? a non-existent opcode. i ? the interrupt mask bit in the condition code register of the cpu08. when i is set, all interrupts are disabled. index register (h:x) ? a 16-bit register in the cpu08. the upper byte of h:x is called h. the lower byte is called x. in the indexed addressing modes, the cpu uses the contents of h:x to determine the effective address of the operand. h:x can also serve as a temporary data storage location. input/output (i/o) ? input/output interfaces between a computer system and the external world. a cpu reads an input to sense the level of an external signal and writes to an output to change the level on an external signal. instructions ? operations that a cpu can perform. instructions are expressed by programmers as assembly language mnemonics. a cpu interprets an opcode and its associated operand(s) and instruction. interrupt ? a temporary break in the sequential execution of a program to respond to signals from peripheral devices by executing a subroutine. interrupt request ? a signal from a peripheral to the cpu intended to cause the cpu to execute a subroutine. i/o ? see input/output (i/0). irq ? see external interrupt module (irq). jitter ? short-term signal instability. latch ? a circuit that retains the voltage level (logic 1 or logic 0) written to it for as long as power is applied to the circuit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 364 glossary motorola glossary latency ? the time lag between instruction completion and data movement. least significant bit (lsb) ? the rightmost digit of a binary number. logic 1 ? a voltage level approximately equal to the input power voltage (v dd ). logic 0 ? a voltage level approximately equal to the ground voltage (v ss ). low byte ? the least significant eight bits of a word. low voltage inhibit module (lvi) ? a module in the m68hc08 family that monitors power supply voltage. lvi ? see low-voltage inhibit module (lvi). m68hc08 ? a motorola family of 8-bit mcus. mark/space ? the logic 1/logic 0 convention used in formatting data in serial communication. mask ? 1. a logic circuit that forces a bit or group of bits to a desired state. 2. a photomask used in integrated circuit fabrication to transfer an image onto silicon. mask option ? an optional microcontroller feature that the customer chooses to enable or disable. mcu ? microcontroller unit. see microcontroller. memory location ? each m68hc08 memory location holds one byte of data and has a unique address. to store information in a memory location, the cpu places the address of the location on the address bus, the data information on the data bus, and asserts the write signal. to read information from a memory location, the cpu places the address of the location on the address bus and asserts the read signal. in response to the read signal, the selected memory location places its data onto the data bus. memory map ? a pictorial representation of all memory locations in a computer system. microcontroller ? microcontroller unit (mcu). a complete computer system, including a cpu, memory, a clock oscillator, and input/output (i/o) on a single integrated circuit. modulo counter ? a counter that can be programmed to count to any number from zero to its maximum possible modulus. monitor rom ? a section of rom that can execute commands from a host computer for testing purposes. most significant bit (msb) ? the leftmost digit of a binary number. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc68hc908mr8 ? rev 4.0 technical data motorola glossary 365 multiplexer ? a device that can select one of a number of inputs and pass the logic level of that input on to the output. n ? the negative bit in the condition code register of the cpu08. the cpu sets the negative bit when an arithmetic operation, logical operation, or data manipulation produces a negative result. nibble ? a set of four bits (half of a byte). object code ? the output from an assembler or compiler that is itself executable machine code or is suitable for processing to produce executable machine code. opcode ? a binary code that instructs the cpu to perform an operation. open-drain ? an output that has no pullup transistor. an external pullup device can be connected to the power supply to provide the logic 1 output voltage. operand ? data on which an operation is performed. usually, a statement consists of an operator and an operand. for example, the operator may be an add instruction, and the operand may be the quantity to be added. oscillator ? a circuit that produces a constant frequency square wave that is used by the computer as a timing and sequencing reference. overflow ? a quantity that is too large to be contained in one byte or one word. page zero ? the first 256 bytes of memory (addresses $0000 ? $00ff). parity ? an error-checking scheme that counts the number of logic 1s in each byte transmitted. in a system that uses odd parity, every byte is expected to have an odd number of logic 1s. in an even parity system, every byte should have an even number of logic 1s. in the transmitter, a parity generator appends an extra bit to each byte to make the number of logic 1s odd for odd parity or even for even parity. a parity checker in the receiver counts the number of logic 1s in each byte. the parity checker generates an error signal if it finds a byte with an incorrect number of logic 1s. pc ? see program counter (pc). peripheral ? a circuit not under direct cpu control. phase-locked loop (pll) ? an oscillator circuit in which the frequency of the oscillator is synchronized to a reference signal. pll ? see phase-locked loop (pll). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 366 glossary motorola glossary pointer ? pointer register. an index register is sometimes called a pointer register because its contents are used in the calculation of the address of an operand and, therefore, points to the operand. polarity ? the two opposite logic levels, logic 1 and logic 0, which correspond to two different voltage levels, v dd and v ss . polling ? periodically reading a status bit to monitor the condition of a peripheral device. port ? a set of wires for communicating with off-chip devices. prescaler ? a circuit that generates an output signal related to the input signal by a fractional scale factor such as 1/2, 1/8, 1/10, etc. program ? a set of computer instructions that causes a computer to perform a desired operation or operations. program counter (pc) ? a 16-bit register in the cpu08. the pc register holds the address of the next instruction or operand that the cpu will use. pull ? an instruction that copies into the accumulator the contents of a stack ram location. the stack ram address is in the stack pointer. pullup ? a transistor in the output of a logic gate that connects the output to the logic 1 voltage of the power supply. pulse-width ? the amount of time a signal is on as opposed to being in its off state. pulse-width modulation (pwm) ? controlled variation (modulation) of the pulse width of a signal with a constant frequency. push ? an instruction that copies the contents of the accumulator to the stack ram. the stack ram address is in the stack pointer. pwm period ? the time required for one complete cycle of a pwm waveform. pmc ? pulse width modulated motor control module ram ? random access memory. all ram locations can be read or written by the cpu. the contents of a ram memory location remain valid until the cpu writes a different value or until power is turned off. rc circuit ? a circuit consisting of capacitors and resistors having a defined time constant. read ? to copy the contents of a memory location to the accumulator. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc68hc908mr8 ? rev 4.0 technical data motorola glossary 367 register ? a circuit that stores a group of bits. reserved memory location ? a memory location that is used only in special factory test modes. writing to a reserved location has no effect. reading a reserved location returns an unpredictable value. reset ? to force a device to a known condition. rom ? read-only memory. a type of memory that can be read but cannot be changed (written). the contents of rom must be specified before manufacturing the mcu. sci ? see serial communication interface module (sci). serial ? pertaining to sequential transmission over a single line. serial communication interface module (sci) ? a module in the m68hc08 family that supports asynchronous communication. serial peripheral interface module (spi) ? a module in the m68hc08 family that supports synchronous communication. set ? to change a bit from logic 0 to logic 1; opposite of clear. shift register ? a chain of circuits that can retain the logic levels (logic 1 or logic 0) written to them and that can shift the logic levels to the right or left through adjacent circuits in the chain. signed ? a binary number notation that accommodates both positive and negative numbers. the most significant bit is used to indicate whether the number is positive or negative, normally logic 0 for positive and logic 1 for negative. the other seven bits indicate the magnitude of the number. sim ? see system integration module (sim). software ? instructions and data that control the operation of a microcontroller. software interrupt (swi) ? an instruction that causes an interrupt and its associated vector fetch. spi ? see serial peripheral interface module (spi). stack ? a portion of ram reserved for storage of cpu register contents and subroutine return addresses. stack pointer (sp) ? a 16-bit register in the cpu08 containing the address of the next available storage location on the stack. start bit ? a bit that signals the beginning of an asynchronous serial transmission. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 368 glossary motorola glossary status bit ? a register bit that indicates the condition of a device. stop bit ? a bit that signals the end of an asynchronous serial transmission. subroutine ? a sequence of instructions to be used more than once in the course of a program. the last instruction in a subroutine is a return from subroutine (rts) instruction. at each place in the main program where the subroutine instructions are needed, a jump or branch to subroutine (jsr or bsr) instruction is used to call the subroutine. the cpu leaves the flow of the main program to execute the instructions in the subroutine. when the rts instruction is executed, the cpu returns to the main program where it left off. synchronous ? refers to logic circuits and operations that are synchronized by a common reference signal. system integration module (sim) ? one of a number of modules that handle a variety of control functions in the modular m68hc08 family. the sim controls mode of operation, resets and interrupts, and system clock distribution. tim ? see timer interface module (tim). timer interface module (tim) ? a module used to relate events in a system to a point in time. timer ? a module used to relate events in a system to a point in time. toggle ? to change the state of an output from a logic 0 to a logic 1 or from a logic 1 to a logic 0. tracking mode ? mode of low-jitter pll operation during which the pll is locked on a frequency. also see acquisition mode. two ? s complement ? a means of performing binary subtraction using addition techniques. the most significant bit of a two ? s complement number indicates the sign of the number (1 indicates negative). the two ? s complement negative of a number is obtained by inverting each bit in the number and then adding 1 to the result. unbuffered ? utilizes only one register for data; new data overwrites current data. unimplemented memory location ? a memory location that is not used. writing to an unimplemented location has no effect. reading an unimplemented location returns an unpredictable value. executing an opcode at an unimplemented location causes an illegal address reset. v ? the overflow bit in the condition code register of the cpu08. the cpu08 sets the v bit when a two's complement overflow occurs. the signed branch instructions bgt, bge, ble, and blt use the overflow bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc68hc908mr8 ? rev 4.0 technical data motorola glossary 369 variable ? a value that changes during the course of program execution. vco ? see voltage-controlled oscillator. vector ? a memory location that contains the address of the beginning of a subroutine written to service an interrupt or reset. voltage-controlled oscillator (vco) ? a circuit that produces an oscillating output signal of a frequency that is controlled by a dc voltage applied to a control input. waveform ? a graphical representation in which the amplitude of a wave is plotted against time. wired-or ? connection of circuit outputs so that if any output is high, the connection point is high. word ? a set of two bytes (16 bits). write ? the transfer of a byte of data from the cpu to a memory location. x ? the lower byte of the index register (h:x) in the cpu08. z ? the zero bit in the condition code register of the cpu08. the cpu08 sets the zero bit when an arithmetic operation, logical operation, or data manipulation produces a result of $00. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
technical data mc68hc908mr8 ? rev 4.0 370 glossary motorola glossary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
how to reach us: usa/europe/locations not listed: motorola literature distribution; p.o. box 5405, denver, colorado 80217 1-303-675-2140 or 1-800-441-2447 japan: motorola japan ltd.; sps, technical information center, 3-20-1, minami-azabu minato-ku, tokyo 106-8573 japan 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd.; silicon harbour centre, 2 dai king street, tai po industrial estate, tai po, n.t., hong kong 852-26668334 technical information center: 1-800-521-6274 home page: http://www.motorola.com/semiconductors information in this document is provided solely to enable system and software implementers to use motorola products. there are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. ? typical ? parameters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all operating parameters, including ? typicals ? must be validated for each customer application by customer ? s technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and the stylized m logo are registered in the u.s. patent and trademark office. digital dna is a trademark of motorola, inc. all other product or service names are the property of their respective owners. motorola, inc. is an equal opportunity/affirmative action employer. ? motorola, inc. 2002 mc68hc908mr8/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .


▲Up To Search▲   

 
Price & Availability of MC68HC908MR8VDW

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X